@@ -1,1166 +1,1194 | |||
|
1 | 1 | ''' |
|
2 | 2 | Created on September , 2012 |
|
3 | 3 | @author: |
|
4 | 4 | ''' |
|
5 | 5 | from xml.etree.ElementTree import Element, SubElement |
|
6 | 6 | from xml.etree import ElementTree as ET |
|
7 | 7 | from xml.dom import minidom |
|
8 | 8 | |
|
9 | 9 | #import datetime |
|
10 | 10 | from model import * |
|
11 | 11 | |
|
12 | 12 | try: |
|
13 | 13 | from gevent import sleep |
|
14 | 14 | except: |
|
15 | 15 | from time import sleep |
|
16 | 16 | |
|
17 | 17 | import ast |
|
18 | 18 | |
|
19 | 19 | def prettify(elem): |
|
20 | 20 | """Return a pretty-printed XML string for the Element. |
|
21 | 21 | """ |
|
22 | 22 | rough_string = ET.tostring(elem, 'utf-8') |
|
23 | 23 | reparsed = minidom.parseString(rough_string) |
|
24 | 24 | return reparsed.toprettyxml(indent=" ") |
|
25 | 25 | |
|
26 | 26 | class ParameterConf(): |
|
27 | 27 | |
|
28 | 28 | id = None |
|
29 | 29 | name = None |
|
30 | 30 | value = None |
|
31 | 31 | format = None |
|
32 | 32 | |
|
33 | 33 | __formated_value = None |
|
34 | 34 | |
|
35 | 35 | ELEMENTNAME = 'Parameter' |
|
36 | 36 | |
|
37 | 37 | def __init__(self): |
|
38 | 38 | |
|
39 | 39 | self.format = 'str' |
|
40 | 40 | |
|
41 | 41 | def getElementName(self): |
|
42 | 42 | |
|
43 | 43 | return self.ELEMENTNAME |
|
44 | 44 | |
|
45 | 45 | def getValue(self): |
|
46 | ||
|
46 | ||
|
47 | value = self.value | |
|
48 | format = self.format | |
|
49 | ||
|
47 | 50 | if self.__formated_value != None: |
|
48 | 51 | |
|
49 | 52 | return self.__formated_value |
|
50 | 53 | |
|
51 | value = self.value | |
|
52 | ||
|
53 | if self.format == 'str': | |
|
54 | if format == 'str': | |
|
54 | 55 | self.__formated_value = str(value) |
|
55 | 56 | return self.__formated_value |
|
56 | 57 | |
|
57 | 58 | if value == '': |
|
58 | 59 | raise ValueError, "%s: This parameter value is empty" %self.name |
|
59 | 60 | |
|
60 |
if |
|
|
61 | if format == 'bool': | |
|
61 | 62 | value = int(value) |
|
62 | 63 | |
|
63 |
if |
|
|
64 | if format == 'list': | |
|
64 | 65 | strList = value.split(',') |
|
65 | 66 | |
|
66 | 67 | self.__formated_value = strList |
|
67 | 68 | |
|
68 | 69 | return self.__formated_value |
|
69 | 70 | |
|
70 |
if |
|
|
71 | if format == 'intlist': | |
|
71 | 72 | """ |
|
72 | 73 | Example: |
|
73 | 74 | value = (0,1,2) |
|
74 | 75 | """ |
|
75 | intList = ast.literal_eval(value) | |
|
76 | value = value.replace('(', '') | |
|
77 | value = value.replace(')', '') | |
|
78 | ||
|
79 | value = value.replace('[', '') | |
|
80 | value = value.replace(']', '') | |
|
81 | ||
|
82 | strList = value.split(',') | |
|
83 | intList = [int(x) for x in strList] | |
|
76 | 84 | |
|
77 | 85 | self.__formated_value = intList |
|
78 | 86 | |
|
79 | 87 | return self.__formated_value |
|
80 | 88 | |
|
81 |
if |
|
|
89 | if format == 'floatlist': | |
|
82 | 90 | """ |
|
83 | 91 | Example: |
|
84 | 92 | value = (0.5, 1.4, 2.7) |
|
85 | 93 | """ |
|
86 | 94 | |
|
87 | floatList = ast.literal_eval(value) | |
|
95 | value = value.replace('(', '') | |
|
96 | value = value.replace(')', '') | |
|
97 | ||
|
98 | value = value.replace('[', '') | |
|
99 | value = value.replace(']', '') | |
|
100 | ||
|
101 | strList = value.split(',') | |
|
102 | floatList = [float(x) for x in strList] | |
|
88 | 103 | |
|
89 | 104 | self.__formated_value = floatList |
|
90 | 105 | |
|
91 | 106 | return self.__formated_value |
|
92 | 107 | |
|
93 |
if |
|
|
108 | if format == 'date': | |
|
94 | 109 | strList = value.split('/') |
|
95 | 110 | intList = [int(x) for x in strList] |
|
96 | 111 | date = datetime.date(intList[0], intList[1], intList[2]) |
|
97 | 112 | |
|
98 | 113 | self.__formated_value = date |
|
99 | 114 | |
|
100 | 115 | return self.__formated_value |
|
101 | 116 | |
|
102 |
if |
|
|
117 | if format == 'time': | |
|
103 | 118 | strList = value.split(':') |
|
104 | 119 | intList = [int(x) for x in strList] |
|
105 | 120 | time = datetime.time(intList[0], intList[1], intList[2]) |
|
106 | 121 | |
|
107 | 122 | self.__formated_value = time |
|
108 | 123 | |
|
109 | 124 | return self.__formated_value |
|
110 | 125 | |
|
111 |
if |
|
|
126 | if format == 'pairslist': | |
|
112 | 127 | """ |
|
113 | 128 | Example: |
|
114 | 129 | value = (0,1),(1,2) |
|
115 | 130 | """ |
|
116 | 131 | |
|
117 | pairList = ast.literal_eval(value) | |
|
132 | value = value.replace('(', '') | |
|
133 | value = value.replace(')', '') | |
|
134 | ||
|
135 | value = value.replace('[', '') | |
|
136 | value = value.replace(']', '') | |
|
137 | ||
|
138 | strList = value.split(',') | |
|
139 | intList = [int(item) for item in strList] | |
|
140 | pairList = [] | |
|
141 | for i in range(len(intList)/2): | |
|
142 | pairList.append((intList[i*2], intList[i*2 + 1])) | |
|
118 | 143 | |
|
119 | 144 | self.__formated_value = pairList |
|
120 | 145 | |
|
121 | 146 | return self.__formated_value |
|
122 | 147 | |
|
123 |
if |
|
|
148 | if format == 'multilist': | |
|
124 | 149 | """ |
|
125 | 150 | Example: |
|
126 | 151 | value = (0,1,2),(3,4,5) |
|
127 | 152 | """ |
|
128 | 153 | multiList = ast.literal_eval(value) |
|
129 | 154 | |
|
155 | if type(multiList[0]) == int: | |
|
156 | multiList = ast.literal_eval("(" + value + ")") | |
|
157 | ||
|
130 | 158 | self.__formated_value = multiList |
|
131 | 159 | |
|
132 | 160 | return self.__formated_value |
|
133 | 161 | |
|
134 |
format_func = eval( |
|
|
162 | format_func = eval(format) | |
|
135 | 163 | |
|
136 | 164 | self.__formated_value = format_func(value) |
|
137 | 165 | |
|
138 | 166 | return self.__formated_value |
|
139 | 167 | |
|
140 | 168 | def updateId(self, new_id): |
|
141 | 169 | |
|
142 | 170 | self.id = str(new_id) |
|
143 | 171 | |
|
144 | 172 | def setup(self, id, name, value, format='str'): |
|
145 | 173 | |
|
146 | 174 | self.id = str(id) |
|
147 | 175 | self.name = name |
|
148 | 176 | self.value = str(value) |
|
149 | 177 | self.format = str.lower(format) |
|
150 | 178 | |
|
151 | 179 | def update(self, name, value, format='str'): |
|
152 | 180 | |
|
153 | 181 | self.name = name |
|
154 | 182 | self.value = str(value) |
|
155 | 183 | self.format = format |
|
156 | 184 | |
|
157 | 185 | def makeXml(self, opElement): |
|
158 | 186 | |
|
159 | 187 | parmElement = SubElement(opElement, self.ELEMENTNAME) |
|
160 | 188 | parmElement.set('id', str(self.id)) |
|
161 | 189 | parmElement.set('name', self.name) |
|
162 | 190 | parmElement.set('value', self.value) |
|
163 | 191 | parmElement.set('format', self.format) |
|
164 | 192 | |
|
165 | 193 | def readXml(self, parmElement): |
|
166 | 194 | |
|
167 | 195 | self.id = parmElement.get('id') |
|
168 | 196 | self.name = parmElement.get('name') |
|
169 | 197 | self.value = parmElement.get('value') |
|
170 | 198 | self.format = str.lower(parmElement.get('format')) |
|
171 | 199 | |
|
172 | 200 | #Compatible with old signal chain version |
|
173 | 201 | if self.format == 'int' and self.name == 'idfigure': |
|
174 | 202 | self.name = 'id' |
|
175 | 203 | |
|
176 | 204 | def printattr(self): |
|
177 | 205 | |
|
178 | 206 | print "Parameter[%s]: name = %s, value = %s, format = %s" %(self.id, self.name, self.value, self.format) |
|
179 | 207 | |
|
180 | 208 | class OperationConf(): |
|
181 | 209 | |
|
182 | 210 | id = None |
|
183 | 211 | name = None |
|
184 | 212 | priority = None |
|
185 | 213 | type = None |
|
186 | 214 | |
|
187 | 215 | parmConfObjList = [] |
|
188 | 216 | |
|
189 | 217 | ELEMENTNAME = 'Operation' |
|
190 | 218 | |
|
191 | 219 | def __init__(self): |
|
192 | 220 | |
|
193 | 221 | self.id = '0' |
|
194 | 222 | self.name = None |
|
195 | 223 | self.priority = None |
|
196 | 224 | self.type = 'self' |
|
197 | 225 | |
|
198 | 226 | |
|
199 | 227 | def __getNewId(self): |
|
200 | 228 | |
|
201 | 229 | return int(self.id)*10 + len(self.parmConfObjList) + 1 |
|
202 | 230 | |
|
203 | 231 | def updateId(self, new_id): |
|
204 | 232 | |
|
205 | 233 | self.id = str(new_id) |
|
206 | 234 | |
|
207 | 235 | n = 1 |
|
208 | 236 | for parmObj in self.parmConfObjList: |
|
209 | 237 | |
|
210 | 238 | idParm = str(int(new_id)*10 + n) |
|
211 | 239 | parmObj.updateId(idParm) |
|
212 | 240 | |
|
213 | 241 | n += 1 |
|
214 | 242 | |
|
215 | 243 | def getElementName(self): |
|
216 | 244 | |
|
217 | 245 | return self.ELEMENTNAME |
|
218 | 246 | |
|
219 | 247 | def getParameterObjList(self): |
|
220 | 248 | |
|
221 | 249 | return self.parmConfObjList |
|
222 | 250 | |
|
223 | 251 | def getParameterObj(self, parameterName): |
|
224 | 252 | |
|
225 | 253 | for parmConfObj in self.parmConfObjList: |
|
226 | 254 | |
|
227 | 255 | if parmConfObj.name != parameterName: |
|
228 | 256 | continue |
|
229 | 257 | |
|
230 | 258 | return parmConfObj |
|
231 | 259 | |
|
232 | 260 | return None |
|
233 | 261 | |
|
234 | 262 | def getParameterObjfromValue(self,parameterValue): |
|
235 | 263 | for parmConfObj in self.parmConfObjList: |
|
236 | 264 | |
|
237 | 265 | if parmConfObj.getValue() != parameterValue: |
|
238 | 266 | continue |
|
239 | 267 | |
|
240 | 268 | return parmConfObj.getValue() |
|
241 | 269 | |
|
242 | 270 | return None |
|
243 | 271 | |
|
244 | 272 | def getParameterValue(self, parameterName): |
|
245 | 273 | |
|
246 | 274 | parameterObj = self.getParameterObj(parameterName) |
|
247 | 275 | value = parameterObj.getValue() |
|
248 | 276 | |
|
249 | 277 | return value |
|
250 | 278 | |
|
251 | 279 | def setup(self, id, name, priority, type): |
|
252 | 280 | |
|
253 | 281 | self.id = str(id) |
|
254 | 282 | self.name = name |
|
255 | 283 | self.type = type |
|
256 | 284 | self.priority = priority |
|
257 | 285 | |
|
258 | 286 | self.parmConfObjList = [] |
|
259 | 287 | |
|
260 | 288 | def removeParameters(self): |
|
261 | 289 | |
|
262 | 290 | for obj in self.parmConfObjList: |
|
263 | 291 | del obj |
|
264 | 292 | |
|
265 | 293 | self.parmConfObjList = [] |
|
266 | 294 | |
|
267 | 295 | def addParameter(self, name, value, format='str'): |
|
268 | 296 | |
|
269 | 297 | id = self.__getNewId() |
|
270 | 298 | |
|
271 | 299 | parmConfObj = ParameterConf() |
|
272 | 300 | parmConfObj.setup(id, name, value, format) |
|
273 | 301 | |
|
274 | 302 | self.parmConfObjList.append(parmConfObj) |
|
275 | 303 | |
|
276 | 304 | return parmConfObj |
|
277 | 305 | |
|
278 | 306 | def changeParameter(self, name, value, format='str'): |
|
279 | 307 | |
|
280 | 308 | parmConfObj = self.getParameterObj(name) |
|
281 | 309 | parmConfObj.update(name, value, format) |
|
282 | 310 | |
|
283 | 311 | return parmConfObj |
|
284 | 312 | |
|
285 | 313 | def makeXml(self, upElement): |
|
286 | 314 | |
|
287 | 315 | opElement = SubElement(upElement, self.ELEMENTNAME) |
|
288 | 316 | opElement.set('id', str(self.id)) |
|
289 | 317 | opElement.set('name', self.name) |
|
290 | 318 | opElement.set('type', self.type) |
|
291 | 319 | opElement.set('priority', str(self.priority)) |
|
292 | 320 | |
|
293 | 321 | for parmConfObj in self.parmConfObjList: |
|
294 | 322 | parmConfObj.makeXml(opElement) |
|
295 | 323 | |
|
296 | 324 | def readXml(self, opElement): |
|
297 | 325 | |
|
298 | 326 | self.id = opElement.get('id') |
|
299 | 327 | self.name = opElement.get('name') |
|
300 | 328 | self.type = opElement.get('type') |
|
301 | 329 | self.priority = opElement.get('priority') |
|
302 | 330 | |
|
303 | 331 | #Compatible with old signal chain version |
|
304 | 332 | #Use of 'run' method instead 'init' |
|
305 | 333 | if self.type == 'self' and self.name == 'init': |
|
306 | 334 | self.name = 'run' |
|
307 | 335 | |
|
308 | 336 | self.parmConfObjList = [] |
|
309 | 337 | |
|
310 | 338 | parmElementList = opElement.getiterator(ParameterConf().getElementName()) |
|
311 | 339 | |
|
312 | 340 | for parmElement in parmElementList: |
|
313 | 341 | parmConfObj = ParameterConf() |
|
314 | 342 | parmConfObj.readXml(parmElement) |
|
315 | 343 | |
|
316 | 344 | #Compatible with old signal chain version |
|
317 | 345 | #If an 'plot' OPERATION is found, changes name operation by the value of its type PARAMETER |
|
318 | 346 | if self.type != 'self' and self.name == 'Plot': |
|
319 | 347 | if parmConfObj.format == 'str' and parmConfObj.name == 'type': |
|
320 | 348 | self.name = parmConfObj.value |
|
321 | 349 | continue |
|
322 | 350 | |
|
323 | 351 | self.parmConfObjList.append(parmConfObj) |
|
324 | 352 | |
|
325 | 353 | def printattr(self): |
|
326 | 354 | |
|
327 | 355 | print "%s[%s]: name = %s, type = %s, priority = %s" %(self.ELEMENTNAME, |
|
328 | 356 | self.id, |
|
329 | 357 | self.name, |
|
330 | 358 | self.type, |
|
331 | 359 | self.priority) |
|
332 | 360 | |
|
333 | 361 | for parmConfObj in self.parmConfObjList: |
|
334 | 362 | parmConfObj.printattr() |
|
335 | 363 | |
|
336 | 364 | def createObject(self): |
|
337 | 365 | |
|
338 | 366 | if self.type == 'self': |
|
339 | 367 | raise ValueError, "This operation type cannot be created" |
|
340 | 368 | |
|
341 | 369 | if self.type == 'external' or self.type == 'other': |
|
342 | 370 | className = eval(self.name) |
|
343 | 371 | opObj = className() |
|
344 | 372 | |
|
345 | 373 | return opObj |
|
346 | 374 | |
|
347 | 375 | class ProcUnitConf(): |
|
348 | 376 | |
|
349 | 377 | id = None |
|
350 | 378 | name = None |
|
351 | 379 | datatype = None |
|
352 | 380 | inputId = None |
|
353 | 381 | parentId = None |
|
354 | 382 | |
|
355 | 383 | opConfObjList = [] |
|
356 | 384 | |
|
357 | 385 | procUnitObj = None |
|
358 | 386 | opObjList = [] |
|
359 | 387 | |
|
360 | 388 | ELEMENTNAME = 'ProcUnit' |
|
361 | 389 | |
|
362 | 390 | def __init__(self): |
|
363 | 391 | |
|
364 | 392 | self.id = None |
|
365 | 393 | self.datatype = None |
|
366 | 394 | self.name = None |
|
367 | 395 | self.inputId = None |
|
368 | 396 | |
|
369 | 397 | self.opConfObjList = [] |
|
370 | 398 | |
|
371 | 399 | self.procUnitObj = None |
|
372 | 400 | self.opObjDict = {} |
|
373 | 401 | |
|
374 | 402 | def __getPriority(self): |
|
375 | 403 | |
|
376 | 404 | return len(self.opConfObjList)+1 |
|
377 | 405 | |
|
378 | 406 | def __getNewId(self): |
|
379 | 407 | |
|
380 | 408 | return int(self.id)*10 + len(self.opConfObjList) + 1 |
|
381 | 409 | |
|
382 | 410 | def getElementName(self): |
|
383 | 411 | |
|
384 | 412 | return self.ELEMENTNAME |
|
385 | 413 | |
|
386 | 414 | def getId(self): |
|
387 | 415 | |
|
388 | 416 | return self.id |
|
389 | 417 | |
|
390 | 418 | def updateId(self, new_id, parentId=parentId): |
|
391 | 419 | |
|
392 | 420 | |
|
393 | 421 | new_id = int(parentId)*10 + (int(self.id) % 10) |
|
394 | 422 | new_inputId = int(parentId)*10 + (int(self.inputId) % 10) |
|
395 | 423 | |
|
396 | 424 | #If this proc unit has not inputs |
|
397 | 425 | if self.inputId == '0': |
|
398 | 426 | new_inputId = 0 |
|
399 | 427 | |
|
400 | 428 | n = 1 |
|
401 | 429 | for opConfObj in self.opConfObjList: |
|
402 | 430 | |
|
403 | 431 | idOp = str(int(new_id)*10 + n) |
|
404 | 432 | opConfObj.updateId(idOp) |
|
405 | 433 | |
|
406 | 434 | n += 1 |
|
407 | 435 | |
|
408 | 436 | self.parentId = str(parentId) |
|
409 | 437 | self.id = str(new_id) |
|
410 | 438 | self.inputId = str(new_inputId) |
|
411 | 439 | |
|
412 | 440 | |
|
413 | 441 | def getInputId(self): |
|
414 | 442 | |
|
415 | 443 | return self.inputId |
|
416 | 444 | |
|
417 | 445 | def getOperationObjList(self): |
|
418 | 446 | |
|
419 | 447 | return self.opConfObjList |
|
420 | 448 | |
|
421 | 449 | def getOperationObj(self, name=None): |
|
422 | 450 | |
|
423 | 451 | for opConfObj in self.opConfObjList: |
|
424 | 452 | |
|
425 | 453 | if opConfObj.name != name: |
|
426 | 454 | continue |
|
427 | 455 | |
|
428 | 456 | return opConfObj |
|
429 | 457 | |
|
430 | 458 | return None |
|
431 | 459 | |
|
432 | 460 | def getOpObjfromParamValue(self,value=None): |
|
433 | 461 | |
|
434 | 462 | for opConfObj in self.opConfObjList: |
|
435 | 463 | if opConfObj.getParameterObjfromValue(parameterValue=value) != value: |
|
436 | 464 | continue |
|
437 | 465 | return opConfObj |
|
438 | 466 | return None |
|
439 | 467 | |
|
440 | 468 | def getProcUnitObj(self): |
|
441 | 469 | |
|
442 | 470 | return self.procUnitObj |
|
443 | 471 | |
|
444 | 472 | def setup(self, id, name, datatype, inputId, parentId=None): |
|
445 | 473 | |
|
446 | 474 | #Compatible with old signal chain version |
|
447 | 475 | if datatype==None and name==None: |
|
448 | 476 | raise ValueError, "datatype or name should be defined" |
|
449 | 477 | |
|
450 | 478 | if name==None: |
|
451 | 479 | if 'Proc' in datatype: |
|
452 | 480 | name = datatype |
|
453 | 481 | else: |
|
454 | 482 | name = '%sProc' %(datatype) |
|
455 | 483 | |
|
456 | 484 | if datatype==None: |
|
457 | 485 | datatype = name.replace('Proc','') |
|
458 | 486 | |
|
459 | 487 | self.id = str(id) |
|
460 | 488 | self.name = name |
|
461 | 489 | self.datatype = datatype |
|
462 | 490 | self.inputId = inputId |
|
463 | 491 | self.parentId = parentId |
|
464 | 492 | |
|
465 | 493 | self.opConfObjList = [] |
|
466 | 494 | |
|
467 | 495 | self.addOperation(name='run', optype='self') |
|
468 | 496 | |
|
469 | 497 | def removeOperations(self): |
|
470 | 498 | |
|
471 | 499 | for obj in self.opConfObjList: |
|
472 | 500 | del obj |
|
473 | 501 | |
|
474 | 502 | self.opConfObjList = [] |
|
475 | 503 | self.addOperation(name='run') |
|
476 | 504 | |
|
477 | 505 | def addParameter(self, **kwargs): |
|
478 | 506 | ''' |
|
479 | 507 | Add parameters to "run" operation |
|
480 | 508 | ''' |
|
481 | 509 | opObj = self.opConfObjList[0] |
|
482 | 510 | |
|
483 | 511 | opObj.addParameter(**kwargs) |
|
484 | 512 | |
|
485 | 513 | return opObj |
|
486 | 514 | |
|
487 | 515 | def addOperation(self, name, optype='self'): |
|
488 | 516 | |
|
489 | 517 | id = self.__getNewId() |
|
490 | 518 | priority = self.__getPriority() |
|
491 | 519 | |
|
492 | 520 | opConfObj = OperationConf() |
|
493 | 521 | opConfObj.setup(id, name=name, priority=priority, type=optype) |
|
494 | 522 | |
|
495 | 523 | self.opConfObjList.append(opConfObj) |
|
496 | 524 | |
|
497 | 525 | return opConfObj |
|
498 | 526 | |
|
499 | 527 | def makeXml(self, procUnitElement): |
|
500 | 528 | |
|
501 | 529 | upElement = SubElement(procUnitElement, self.ELEMENTNAME) |
|
502 | 530 | upElement.set('id', str(self.id)) |
|
503 | 531 | upElement.set('name', self.name) |
|
504 | 532 | upElement.set('datatype', self.datatype) |
|
505 | 533 | upElement.set('inputId', str(self.inputId)) |
|
506 | 534 | |
|
507 | 535 | for opConfObj in self.opConfObjList: |
|
508 | 536 | opConfObj.makeXml(upElement) |
|
509 | 537 | |
|
510 | 538 | def readXml(self, upElement): |
|
511 | 539 | |
|
512 | 540 | self.id = upElement.get('id') |
|
513 | 541 | self.name = upElement.get('name') |
|
514 | 542 | self.datatype = upElement.get('datatype') |
|
515 | 543 | self.inputId = upElement.get('inputId') |
|
516 | 544 | |
|
517 | 545 | if self.ELEMENTNAME == "ReadUnit": |
|
518 | 546 | self.datatype = self.datatype.replace("Reader", "") |
|
519 | 547 | |
|
520 | 548 | if self.ELEMENTNAME == "ProcUnit": |
|
521 | 549 | self.datatype = self.datatype.replace("Proc", "") |
|
522 | 550 | |
|
523 | 551 | if self.inputId == 'None': |
|
524 | 552 | self.inputId = '0' |
|
525 | 553 | |
|
526 | 554 | self.opConfObjList = [] |
|
527 | 555 | |
|
528 | 556 | opElementList = upElement.getiterator(OperationConf().getElementName()) |
|
529 | 557 | |
|
530 | 558 | for opElement in opElementList: |
|
531 | 559 | opConfObj = OperationConf() |
|
532 | 560 | opConfObj.readXml(opElement) |
|
533 | 561 | self.opConfObjList.append(opConfObj) |
|
534 | 562 | |
|
535 | 563 | def printattr(self): |
|
536 | 564 | |
|
537 | 565 | print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, |
|
538 | 566 | self.id, |
|
539 | 567 | self.name, |
|
540 | 568 | self.datatype, |
|
541 | 569 | self.inputId) |
|
542 | 570 | |
|
543 | 571 | for opConfObj in self.opConfObjList: |
|
544 | 572 | opConfObj.printattr() |
|
545 | 573 | |
|
546 | 574 | def createObjects(self): |
|
547 | 575 | |
|
548 | 576 | className = eval(self.name) |
|
549 | 577 | procUnitObj = className() |
|
550 | 578 | |
|
551 | 579 | for opConfObj in self.opConfObjList: |
|
552 | 580 | |
|
553 | 581 | if opConfObj.type == 'self': |
|
554 | 582 | continue |
|
555 | 583 | |
|
556 | 584 | opObj = opConfObj.createObject() |
|
557 | 585 | |
|
558 | 586 | self.opObjDict[opConfObj.id] = opObj |
|
559 | 587 | procUnitObj.addOperation(opObj, opConfObj.id) |
|
560 | 588 | |
|
561 | 589 | self.procUnitObj = procUnitObj |
|
562 | 590 | |
|
563 | 591 | return procUnitObj |
|
564 | 592 | |
|
565 | 593 | def run(self): |
|
566 | 594 | |
|
567 | 595 | finalSts = False |
|
568 | 596 | |
|
569 | 597 | for opConfObj in self.opConfObjList: |
|
570 | 598 | |
|
571 | 599 | kwargs = {} |
|
572 | 600 | for parmConfObj in opConfObj.getParameterObjList(): |
|
573 | 601 | if opConfObj.name == 'run' and parmConfObj.name == 'datatype': |
|
574 | 602 | continue |
|
575 | 603 | |
|
576 | 604 | kwargs[parmConfObj.name] = parmConfObj.getValue() |
|
577 | 605 | |
|
578 | 606 | #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id) |
|
579 | 607 | sts = self.procUnitObj.call(opType = opConfObj.type, |
|
580 | 608 | opName = opConfObj.name, |
|
581 | 609 | opId = opConfObj.id, |
|
582 | 610 | **kwargs) |
|
583 | 611 | finalSts = finalSts or sts |
|
584 | 612 | |
|
585 | 613 | return finalSts |
|
586 | 614 | |
|
587 | 615 | def close(self): |
|
588 | 616 | |
|
589 | 617 | for opConfObj in self.opConfObjList: |
|
590 | 618 | if opConfObj.type == 'self': |
|
591 | 619 | continue |
|
592 | 620 | |
|
593 | 621 | opObj = self.procUnitObj.getOperationObj(opConfObj.id) |
|
594 | 622 | opObj.close() |
|
595 | 623 | |
|
596 | 624 | self.procUnitObj.close() |
|
597 | 625 | |
|
598 | 626 | return |
|
599 | 627 | |
|
600 | 628 | class ReadUnitConf(ProcUnitConf): |
|
601 | 629 | |
|
602 | 630 | path = None |
|
603 | 631 | startDate = None |
|
604 | 632 | endDate = None |
|
605 | 633 | startTime = None |
|
606 | 634 | endTime = None |
|
607 | 635 | |
|
608 | 636 | ELEMENTNAME = 'ReadUnit' |
|
609 | 637 | |
|
610 | 638 | def __init__(self): |
|
611 | 639 | |
|
612 | 640 | self.id = None |
|
613 | 641 | self.datatype = None |
|
614 | 642 | self.name = None |
|
615 | 643 | self.inputId = None |
|
616 | 644 | |
|
617 | 645 | self.parentId = None |
|
618 | 646 | |
|
619 | 647 | self.opConfObjList = [] |
|
620 | 648 | self.opObjList = [] |
|
621 | 649 | |
|
622 | 650 | def getElementName(self): |
|
623 | 651 | |
|
624 | 652 | return self.ELEMENTNAME |
|
625 | 653 | |
|
626 | 654 | def setup(self, id, name, datatype, path, startDate="", endDate="", startTime="", endTime="", parentId=None, **kwargs): |
|
627 | 655 | |
|
628 | 656 | #Compatible with old signal chain version |
|
629 | 657 | if datatype==None and name==None: |
|
630 | 658 | raise ValueError, "datatype or name should be defined" |
|
631 | 659 | |
|
632 | 660 | if name==None: |
|
633 | 661 | if 'Reader' in datatype: |
|
634 | 662 | name = datatype |
|
635 | 663 | else: |
|
636 | 664 | name = '%sReader' %(datatype) |
|
637 | 665 | |
|
638 | 666 | if datatype==None: |
|
639 | 667 | datatype = name.replace('Reader','') |
|
640 | 668 | |
|
641 | 669 | self.id = id |
|
642 | 670 | self.name = name |
|
643 | 671 | self.datatype = datatype |
|
644 | 672 | |
|
645 | 673 | self.path = path |
|
646 | 674 | self.startDate = startDate |
|
647 | 675 | self.endDate = endDate |
|
648 | 676 | self.startTime = startTime |
|
649 | 677 | self.endTime = endTime |
|
650 | 678 | |
|
651 | 679 | self.inputId = '0' |
|
652 | 680 | self.parentId = parentId |
|
653 | 681 | |
|
654 | 682 | self.addRunOperation(**kwargs) |
|
655 | 683 | |
|
656 | 684 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, name=None, **kwargs): |
|
657 | 685 | |
|
658 | 686 | #Compatible with old signal chain version |
|
659 | 687 | if datatype==None and name==None: |
|
660 | 688 | raise ValueError, "datatype or name should be defined" |
|
661 | 689 | |
|
662 | 690 | if name==None: |
|
663 | 691 | if 'Reader' in datatype: |
|
664 | 692 | name = datatype |
|
665 | 693 | else: |
|
666 | 694 | name = '%sReader' %(datatype) |
|
667 | 695 | |
|
668 | 696 | if datatype==None: |
|
669 | 697 | datatype = name.replace('Reader','') |
|
670 | 698 | |
|
671 | 699 | self.datatype = datatype |
|
672 | 700 | self.name = name |
|
673 | 701 | self.path = path |
|
674 | 702 | self.startDate = startDate |
|
675 | 703 | self.endDate = endDate |
|
676 | 704 | self.startTime = startTime |
|
677 | 705 | self.endTime = endTime |
|
678 | 706 | |
|
679 | 707 | self.inputId = '0' |
|
680 | 708 | self.parentId = parentId |
|
681 | 709 | |
|
682 | 710 | self.updateRunOperation(**kwargs) |
|
683 | 711 | |
|
684 | 712 | def addRunOperation(self, **kwargs): |
|
685 | 713 | |
|
686 | 714 | opObj = self.addOperation(name = 'run', optype = 'self') |
|
687 | 715 | |
|
688 | 716 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
689 | 717 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
690 | 718 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
691 | 719 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
692 | 720 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
693 | 721 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
694 | 722 | |
|
695 | 723 | for key, value in kwargs.items(): |
|
696 | 724 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
697 | 725 | |
|
698 | 726 | return opObj |
|
699 | 727 | |
|
700 | 728 | def updateRunOperation(self, **kwargs): |
|
701 | 729 | |
|
702 | 730 | opObj = self.getOperationObj(name = 'run') |
|
703 | 731 | opObj.removeParameters() |
|
704 | 732 | |
|
705 | 733 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
706 | 734 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
707 | 735 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
708 | 736 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
709 | 737 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
710 | 738 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
711 | 739 | |
|
712 | 740 | for key, value in kwargs.items(): |
|
713 | 741 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
714 | 742 | |
|
715 | 743 | return opObj |
|
716 | 744 | |
|
717 | 745 | class Project(): |
|
718 | 746 | |
|
719 | 747 | id = None |
|
720 | 748 | name = None |
|
721 | 749 | description = None |
|
722 | 750 | # readUnitConfObjList = None |
|
723 | 751 | procUnitConfObjDict = None |
|
724 | 752 | |
|
725 | 753 | ELEMENTNAME = 'Project' |
|
726 | 754 | |
|
727 | 755 | def __init__(self, control=None, dataq=None): |
|
728 | 756 | |
|
729 | 757 | self.id = None |
|
730 | 758 | self.name = None |
|
731 | 759 | self.description = None |
|
732 | 760 | |
|
733 | 761 | self.procUnitConfObjDict = {} |
|
734 | 762 | |
|
735 | 763 | #global data_q |
|
736 | 764 | #data_q = dataq |
|
737 | 765 | |
|
738 | 766 | if control==None: |
|
739 | 767 | control = {'stop':False,'pause':False} |
|
740 | 768 | |
|
741 | 769 | self.control = control |
|
742 | 770 | |
|
743 | 771 | def __getNewId(self): |
|
744 | 772 | |
|
745 | 773 | id = int(self.id)*10 + len(self.procUnitConfObjDict) + 1 |
|
746 | 774 | |
|
747 | 775 | return str(id) |
|
748 | 776 | |
|
749 | 777 | def getElementName(self): |
|
750 | 778 | |
|
751 | 779 | return self.ELEMENTNAME |
|
752 | 780 | |
|
753 | 781 | def getId(self): |
|
754 | 782 | |
|
755 | 783 | return self.id |
|
756 | 784 | |
|
757 | 785 | def updateId(self, new_id): |
|
758 | 786 | |
|
759 | 787 | self.id = str(new_id) |
|
760 | 788 | |
|
761 | 789 | keyList = self.procUnitConfObjDict.keys() |
|
762 | 790 | keyList.sort() |
|
763 | 791 | |
|
764 | 792 | n = 1 |
|
765 | 793 | newProcUnitConfObjDict = {} |
|
766 | 794 | |
|
767 | 795 | for procKey in keyList: |
|
768 | 796 | |
|
769 | 797 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
770 | 798 | idProcUnit = str(int(self.id)*10 + n) |
|
771 | 799 | procUnitConfObj.updateId(idProcUnit, parentId = self.id) |
|
772 | 800 | |
|
773 | 801 | newProcUnitConfObjDict[idProcUnit] = procUnitConfObj |
|
774 | 802 | n += 1 |
|
775 | 803 | |
|
776 | 804 | self.procUnitConfObjDict = newProcUnitConfObjDict |
|
777 | 805 | |
|
778 | 806 | def setup(self, id, name, description): |
|
779 | 807 | |
|
780 | 808 | self.id = str(id) |
|
781 | 809 | self.name = name |
|
782 | 810 | self.description = description |
|
783 | 811 | |
|
784 | 812 | def update(self, name, description): |
|
785 | 813 | |
|
786 | 814 | self.name = name |
|
787 | 815 | self.description = description |
|
788 | 816 | |
|
789 | 817 | def addReadUnit(self, datatype=None, name=None, **kwargs): |
|
790 | 818 | |
|
791 | 819 | idReadUnit = self.__getNewId() |
|
792 | 820 | |
|
793 | 821 | readUnitConfObj = ReadUnitConf() |
|
794 | 822 | readUnitConfObj.setup(idReadUnit, name, datatype, parentId=self.id, **kwargs) |
|
795 | 823 | |
|
796 | 824 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
797 | 825 | |
|
798 | 826 | return readUnitConfObj |
|
799 | 827 | |
|
800 | 828 | def addProcUnit(self, inputId='0', datatype=None, name=None): |
|
801 | 829 | |
|
802 | 830 | idProcUnit = self.__getNewId() |
|
803 | 831 | |
|
804 | 832 | procUnitConfObj = ProcUnitConf() |
|
805 | 833 | procUnitConfObj.setup(idProcUnit, name, datatype, inputId, parentId=self.id) |
|
806 | 834 | |
|
807 | 835 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
808 | 836 | |
|
809 | 837 | return procUnitConfObj |
|
810 | 838 | |
|
811 | 839 | def removeProcUnit(self, id): |
|
812 | 840 | |
|
813 | 841 | if id in self.procUnitConfObjDict.keys(): |
|
814 | 842 | self.procUnitConfObjDict.pop(id) |
|
815 | 843 | |
|
816 | 844 | def getReadUnitId(self): |
|
817 | 845 | |
|
818 | 846 | readUnitConfObj = self.getReadUnitObj() |
|
819 | 847 | |
|
820 | 848 | return readUnitConfObj.id |
|
821 | 849 | |
|
822 | 850 | def getReadUnitObj(self): |
|
823 | 851 | |
|
824 | 852 | for obj in self.procUnitConfObjDict.values(): |
|
825 | 853 | if obj.getElementName() == "ReadUnit": |
|
826 | 854 | return obj |
|
827 | 855 | |
|
828 | 856 | return None |
|
829 | 857 | |
|
830 | 858 | def getProcUnitObj(self, id): |
|
831 | 859 | |
|
832 | 860 | return self.procUnitConfObjDict[id] |
|
833 | 861 | |
|
834 | 862 | def getProcUnitObjByName(self, name): |
|
835 | 863 | |
|
836 | 864 | for obj in self.procUnitConfObjDict.values(): |
|
837 | 865 | if obj.name == name: |
|
838 | 866 | return obj |
|
839 | 867 | |
|
840 | 868 | return None |
|
841 | 869 | |
|
842 | 870 | def makeXml(self): |
|
843 | 871 | |
|
844 | 872 | projectElement = Element('Project') |
|
845 | 873 | projectElement.set('id', str(self.id)) |
|
846 | 874 | projectElement.set('name', self.name) |
|
847 | 875 | projectElement.set('description', self.description) |
|
848 | 876 | |
|
849 | 877 | # for readUnitConfObj in self.readUnitConfObjList: |
|
850 | 878 | # readUnitConfObj.makeXml(projectElement) |
|
851 | 879 | |
|
852 | 880 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
853 | 881 | procUnitConfObj.makeXml(projectElement) |
|
854 | 882 | |
|
855 | 883 | self.projectElement = projectElement |
|
856 | 884 | |
|
857 | 885 | def writeXml(self, filename): |
|
858 | 886 | |
|
859 | 887 | self.makeXml() |
|
860 | 888 | |
|
861 | 889 | #print prettify(self.projectElement) |
|
862 | 890 | |
|
863 | 891 | ElementTree(self.projectElement).write(filename, method='xml') |
|
864 | 892 | |
|
865 | 893 | def readXml(self, filename): |
|
866 | 894 | |
|
867 | 895 | #tree = ET.parse(filename) |
|
868 | 896 | self.projectElement = None |
|
869 | 897 | # self.readUnitConfObjList = [] |
|
870 | 898 | self.procUnitConfObjDict = {} |
|
871 | 899 | |
|
872 | 900 | self.projectElement = ElementTree().parse(filename) |
|
873 | 901 | |
|
874 | 902 | self.project = self.projectElement.tag |
|
875 | 903 | |
|
876 | 904 | self.id = self.projectElement.get('id') |
|
877 | 905 | self.name = self.projectElement.get('name') |
|
878 | 906 | self.description = self.projectElement.get('description') |
|
879 | 907 | |
|
880 | 908 | readUnitElementList = self.projectElement.getiterator(ReadUnitConf().getElementName()) |
|
881 | 909 | |
|
882 | 910 | for readUnitElement in readUnitElementList: |
|
883 | 911 | readUnitConfObj = ReadUnitConf() |
|
884 | 912 | readUnitConfObj.readXml(readUnitElement) |
|
885 | 913 | |
|
886 | 914 | if readUnitConfObj.parentId == None: |
|
887 | 915 | readUnitConfObj.parentId = self.id |
|
888 | 916 | |
|
889 | 917 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
890 | 918 | |
|
891 | 919 | procUnitElementList = self.projectElement.getiterator(ProcUnitConf().getElementName()) |
|
892 | 920 | |
|
893 | 921 | for procUnitElement in procUnitElementList: |
|
894 | 922 | procUnitConfObj = ProcUnitConf() |
|
895 | 923 | procUnitConfObj.readXml(procUnitElement) |
|
896 | 924 | |
|
897 | 925 | if procUnitConfObj.parentId == None: |
|
898 | 926 | procUnitConfObj.parentId = self.id |
|
899 | 927 | |
|
900 | 928 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
901 | 929 | |
|
902 | 930 | def printattr(self): |
|
903 | 931 | |
|
904 | 932 | print "Project[%s]: name = %s, description = %s" %(self.id, |
|
905 | 933 | self.name, |
|
906 | 934 | self.description) |
|
907 | 935 | |
|
908 | 936 | # for readUnitConfObj in self.readUnitConfObjList: |
|
909 | 937 | # readUnitConfObj.printattr() |
|
910 | 938 | |
|
911 | 939 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
912 | 940 | procUnitConfObj.printattr() |
|
913 | 941 | |
|
914 | 942 | def createObjects(self): |
|
915 | 943 | |
|
916 | 944 | # for readUnitConfObj in self.readUnitConfObjList: |
|
917 | 945 | # readUnitConfObj.createObjects() |
|
918 | 946 | |
|
919 | 947 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
920 | 948 | procUnitConfObj.createObjects() |
|
921 | 949 | |
|
922 | 950 | def __connect(self, objIN, thisObj): |
|
923 | 951 | |
|
924 | 952 | thisObj.setInput(objIN.getOutputObj()) |
|
925 | 953 | |
|
926 | 954 | def connectObjects(self): |
|
927 | 955 | |
|
928 | 956 | for thisPUConfObj in self.procUnitConfObjDict.values(): |
|
929 | 957 | |
|
930 | 958 | inputId = thisPUConfObj.getInputId() |
|
931 | 959 | |
|
932 | 960 | if int(inputId) == 0: |
|
933 | 961 | continue |
|
934 | 962 | |
|
935 | 963 | #Get input object |
|
936 | 964 | puConfINObj = self.procUnitConfObjDict[inputId] |
|
937 | 965 | puObjIN = puConfINObj.getProcUnitObj() |
|
938 | 966 | |
|
939 | 967 | #Get current object |
|
940 | 968 | thisPUObj = thisPUConfObj.getProcUnitObj() |
|
941 | 969 | |
|
942 | 970 | self.__connect(puObjIN, thisPUObj) |
|
943 | 971 | |
|
944 | 972 | def run(self): |
|
945 | 973 | |
|
946 | 974 | # for readUnitConfObj in self.readUnitConfObjList: |
|
947 | 975 | # readUnitConfObj.run() |
|
948 | 976 | |
|
949 | 977 | print "*"*40 |
|
950 | 978 | print " Starting SIGNAL CHAIN PROCESSING " |
|
951 | 979 | print "*"*40 |
|
952 | 980 | |
|
953 | 981 | |
|
954 | 982 | keyList = self.procUnitConfObjDict.keys() |
|
955 | 983 | keyList.sort() |
|
956 | 984 | |
|
957 | 985 | while(True): |
|
958 | 986 | |
|
959 | 987 | finalSts = False |
|
960 | 988 | |
|
961 | 989 | for procKey in keyList: |
|
962 | 990 | # print "Running the '%s' process with %s" %(procUnitConfObj.name, procUnitConfObj.id) |
|
963 | 991 | |
|
964 | 992 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
965 | 993 | sts = procUnitConfObj.run() |
|
966 | 994 | finalSts = finalSts or sts |
|
967 | 995 | |
|
968 | 996 | #If every process unit finished so end process |
|
969 | 997 | if not(finalSts): |
|
970 | 998 | print "Every process unit have finished" |
|
971 | 999 | break |
|
972 | 1000 | |
|
973 | 1001 | if self.control['pause']: |
|
974 | 1002 | print "Process suspended" |
|
975 | 1003 | |
|
976 | 1004 | while True: |
|
977 | 1005 | sleep(0.1) |
|
978 | 1006 | |
|
979 | 1007 | if not self.control['pause']: |
|
980 | 1008 | break |
|
981 | 1009 | |
|
982 | 1010 | if self.control['stop']: |
|
983 | 1011 | break |
|
984 | 1012 | print "Process reinitialized" |
|
985 | 1013 | |
|
986 | 1014 | if self.control['stop']: |
|
987 | 1015 | print "Process stopped" |
|
988 | 1016 | break |
|
989 | 1017 | |
|
990 | 1018 | #Closing every process |
|
991 | 1019 | for procKey in keyList: |
|
992 | 1020 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
993 | 1021 | procUnitConfObj.close() |
|
994 | 1022 | |
|
995 | 1023 | print "Process finished" |
|
996 | 1024 | |
|
997 | 1025 | def start(self, filename): |
|
998 | 1026 | |
|
999 | 1027 | self.writeXml(filename) |
|
1000 | 1028 | self.readXml(filename) |
|
1001 | 1029 | |
|
1002 | 1030 | self.createObjects() |
|
1003 | 1031 | self.connectObjects() |
|
1004 | 1032 | self.run() |
|
1005 | 1033 | |
|
1006 | 1034 | class ControllerThread(threading.Thread, Project): |
|
1007 | 1035 | |
|
1008 | 1036 | def __init__(self, filename): |
|
1009 | 1037 | |
|
1010 | 1038 | threading.Thread.__init__(self) |
|
1011 | 1039 | Project.__init__(self) |
|
1012 | 1040 | |
|
1013 | 1041 | self.setDaemon(True) |
|
1014 | 1042 | |
|
1015 | 1043 | self.filename = filename |
|
1016 | 1044 | self.control = {'stop':False, 'pause':False} |
|
1017 | 1045 | |
|
1018 | 1046 | def stop(self): |
|
1019 | 1047 | self.control['stop'] = True |
|
1020 | 1048 | |
|
1021 | 1049 | def pause(self): |
|
1022 | 1050 | self.control['pause'] = not(self.control['pause']) |
|
1023 | 1051 | |
|
1024 | 1052 | def run(self): |
|
1025 | 1053 | self.control['stop'] = False |
|
1026 | 1054 | self.control['pause'] = False |
|
1027 | 1055 | |
|
1028 | 1056 | self.readXml(self.filename) |
|
1029 | 1057 | self.createObjects() |
|
1030 | 1058 | self.connectObjects() |
|
1031 | 1059 | Project.run(self) |
|
1032 | 1060 | |
|
1033 | 1061 | if __name__ == '__main__': |
|
1034 | 1062 | |
|
1035 | 1063 | desc = "Segundo Test" |
|
1036 | 1064 | filename = "schain.xml" |
|
1037 | 1065 | |
|
1038 | 1066 | controllerObj = Project() |
|
1039 | 1067 | |
|
1040 | 1068 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
1041 | 1069 | |
|
1042 | 1070 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', |
|
1043 | 1071 | path='data/rawdata/', |
|
1044 | 1072 | startDate='2011/01/01', |
|
1045 | 1073 | endDate='2012/12/31', |
|
1046 | 1074 | startTime='00:00:00', |
|
1047 | 1075 | endTime='23:59:59', |
|
1048 | 1076 | online=1, |
|
1049 | 1077 | walk=1) |
|
1050 | 1078 | |
|
1051 | 1079 | # opObj00 = readUnitConfObj.addOperation(name='printInfo') |
|
1052 | 1080 | |
|
1053 | 1081 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) |
|
1054 | 1082 | |
|
1055 | 1083 | opObj10 = procUnitConfObj0.addOperation(name='selectChannels') |
|
1056 | 1084 | opObj10.addParameter(name='channelList', value='3,4,5', format='intlist') |
|
1057 | 1085 | |
|
1058 | 1086 | opObj10 = procUnitConfObj0.addOperation(name='selectHeights') |
|
1059 | 1087 | opObj10.addParameter(name='minHei', value='90', format='float') |
|
1060 | 1088 | opObj10.addParameter(name='maxHei', value='180', format='float') |
|
1061 | 1089 | |
|
1062 | 1090 | opObj12 = procUnitConfObj0.addOperation(name='CohInt', optype='external') |
|
1063 | 1091 | opObj12.addParameter(name='n', value='10', format='int') |
|
1064 | 1092 | |
|
1065 | 1093 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) |
|
1066 | 1094 | procUnitConfObj1.addParameter(name='nFFTPoints', value='32', format='int') |
|
1067 | 1095 | # procUnitConfObj1.addParameter(name='pairList', value='(0,1),(0,2),(1,2)', format='') |
|
1068 | 1096 | |
|
1069 | 1097 | |
|
1070 | 1098 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1071 | 1099 | opObj11.addParameter(name='idfigure', value='1', format='int') |
|
1072 | 1100 | opObj11.addParameter(name='wintitle', value='SpectraPlot0', format='str') |
|
1073 | 1101 | opObj11.addParameter(name='zmin', value='40', format='int') |
|
1074 | 1102 | opObj11.addParameter(name='zmax', value='90', format='int') |
|
1075 | 1103 | opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1076 | 1104 | |
|
1077 | 1105 | # opObj11 = procUnitConfObj1.addOperation(name='CrossSpectraPlot', optype='external') |
|
1078 | 1106 | # opObj11.addParameter(name='idfigure', value='2', format='int') |
|
1079 | 1107 | # opObj11.addParameter(name='wintitle', value='CrossSpectraPlot', format='str') |
|
1080 | 1108 | # opObj11.addParameter(name='zmin', value='40', format='int') |
|
1081 | 1109 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1082 | 1110 | |
|
1083 | 1111 | |
|
1084 | 1112 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='Voltage', inputId=procUnitConfObj0.getId()) |
|
1085 | 1113 | # |
|
1086 | 1114 | # opObj12 = procUnitConfObj2.addOperation(name='CohInt', optype='external') |
|
1087 | 1115 | # opObj12.addParameter(name='n', value='2', format='int') |
|
1088 | 1116 | # opObj12.addParameter(name='overlapping', value='1', format='int') |
|
1089 | 1117 | # |
|
1090 | 1118 | # procUnitConfObj3 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj2.getId()) |
|
1091 | 1119 | # procUnitConfObj3.addParameter(name='nFFTPoints', value='32', format='int') |
|
1092 | 1120 | # |
|
1093 | 1121 | # opObj11 = procUnitConfObj3.addOperation(name='SpectraPlot', optype='external') |
|
1094 | 1122 | # opObj11.addParameter(name='idfigure', value='2', format='int') |
|
1095 | 1123 | # opObj11.addParameter(name='wintitle', value='SpectraPlot1', format='str') |
|
1096 | 1124 | # opObj11.addParameter(name='zmin', value='40', format='int') |
|
1097 | 1125 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1098 | 1126 | # opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1099 | 1127 | |
|
1100 | 1128 | # opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='external') |
|
1101 | 1129 | # opObj11.addParameter(name='idfigure', value='10', format='int') |
|
1102 | 1130 | # opObj11.addParameter(name='wintitle', value='RTI', format='str') |
|
1103 | 1131 | ## opObj11.addParameter(name='xmin', value='21', format='float') |
|
1104 | 1132 | ## opObj11.addParameter(name='xmax', value='22', format='float') |
|
1105 | 1133 | # opObj11.addParameter(name='zmin', value='40', format='int') |
|
1106 | 1134 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1107 | 1135 | # opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1108 | 1136 | # opObj11.addParameter(name='timerange', value=str(60), format='int') |
|
1109 | 1137 | |
|
1110 | 1138 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
1111 | 1139 | # opObj10.addParameter(name='channelList', value='0,2,4,6', format='intlist') |
|
1112 | 1140 | # |
|
1113 | 1141 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='external') |
|
1114 | 1142 | # opObj12.addParameter(name='n', value='2', format='int') |
|
1115 | 1143 | # |
|
1116 | 1144 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1117 | 1145 | # opObj11.addParameter(name='idfigure', value='2', format='int') |
|
1118 | 1146 | # opObj11.addParameter(name='wintitle', value='SpectraPlot10', format='str') |
|
1119 | 1147 | # opObj11.addParameter(name='zmin', value='70', format='int') |
|
1120 | 1148 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1121 | 1149 | # |
|
1122 | 1150 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
1123 | 1151 | # opObj10.addParameter(name='channelList', value='2,6', format='intlist') |
|
1124 | 1152 | # |
|
1125 | 1153 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='external') |
|
1126 | 1154 | # opObj12.addParameter(name='n', value='2', format='int') |
|
1127 | 1155 | # |
|
1128 | 1156 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1129 | 1157 | # opObj11.addParameter(name='idfigure', value='3', format='int') |
|
1130 | 1158 | # opObj11.addParameter(name='wintitle', value='SpectraPlot10', format='str') |
|
1131 | 1159 | # opObj11.addParameter(name='zmin', value='70', format='int') |
|
1132 | 1160 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1133 | 1161 | |
|
1134 | 1162 | |
|
1135 | 1163 | # opObj12 = procUnitConfObj1.addOperation(name='decoder') |
|
1136 | 1164 | # opObj12.addParameter(name='ncode', value='2', format='int') |
|
1137 | 1165 | # opObj12.addParameter(name='nbauds', value='8', format='int') |
|
1138 | 1166 | # opObj12.addParameter(name='code0', value='001110011', format='int') |
|
1139 | 1167 | # opObj12.addParameter(name='code1', value='001110011', format='int') |
|
1140 | 1168 | |
|
1141 | 1169 | |
|
1142 | 1170 | |
|
1143 | 1171 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj1.getId()) |
|
1144 | 1172 | # |
|
1145 | 1173 | # opObj21 = procUnitConfObj2.addOperation(name='IncohInt', optype='external') |
|
1146 | 1174 | # opObj21.addParameter(name='n', value='2', format='int') |
|
1147 | 1175 | # |
|
1148 | 1176 | # opObj11 = procUnitConfObj2.addOperation(name='SpectraPlot', optype='external') |
|
1149 | 1177 | # opObj11.addParameter(name='idfigure', value='4', format='int') |
|
1150 | 1178 | # opObj11.addParameter(name='wintitle', value='SpectraPlot OBJ 2', format='str') |
|
1151 | 1179 | # opObj11.addParameter(name='zmin', value='70', format='int') |
|
1152 | 1180 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1153 | 1181 | |
|
1154 | 1182 | print "Escribiendo el archivo XML" |
|
1155 | 1183 | |
|
1156 | 1184 | controllerObj.writeXml(filename) |
|
1157 | 1185 | |
|
1158 | 1186 | print "Leyendo el archivo XML" |
|
1159 | 1187 | controllerObj.readXml(filename) |
|
1160 | 1188 | #controllerObj.printattr() |
|
1161 | 1189 | |
|
1162 | 1190 | controllerObj.createObjects() |
|
1163 | 1191 | controllerObj.connectObjects() |
|
1164 | 1192 | controllerObj.run() |
|
1165 | 1193 | |
|
1166 | 1194 | No newline at end of file |
This diff has been collapsed as it changes many lines, (3234 lines changed) Show them Hide them | |||
@@ -1,7261 +1,5589 | |||
|
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 | import ast |
|
16 | 16 | |
|
17 | 17 | from PyQt4.QtGui import QMainWindow |
|
18 | 18 | from PyQt4.QtCore import pyqtSignature |
|
19 | 19 | from PyQt4.QtCore import pyqtSignal |
|
20 | 20 | from PyQt4 import QtCore |
|
21 | 21 | from PyQt4 import QtGui |
|
22 | 22 | |
|
23 | 23 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess |
|
24 | 24 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp |
|
25 | 25 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow |
|
26 | 26 | from schainpy.controller import Project, ControllerThread |
|
27 | 27 | |
|
28 | 28 | from propertiesViewModel import TreeModel, PropertyBuffer |
|
29 | 29 | from parametersModel import ProjectParms |
|
30 | 30 | |
|
31 | 31 | from schainpy.gui.figures import tools |
|
32 | 32 | # from schainpy.gui.viewcontroller.comm import ControllerThread |
|
33 | 33 | |
|
34 | 34 | FIGURES_PATH = tools.get_path() |
|
35 | 35 | TEMPORAL_FILE = "./.temp.xml" |
|
36 | 36 | |
|
37 | 37 | def isRadarFile(file): |
|
38 | 38 | try: |
|
39 | 39 | year = int(file[1:5]) |
|
40 | 40 | doy = int(file[5:8]) |
|
41 | 41 | set = int(file[8:11]) |
|
42 | 42 | except: |
|
43 | 43 | return 0 |
|
44 | 44 | |
|
45 | 45 | return 1 |
|
46 | 46 | |
|
47 | 47 | def isRadarPath(path): |
|
48 | 48 | try: |
|
49 | 49 | year = int(path[1:5]) |
|
50 | 50 | doy = int(path[5:8]) |
|
51 | 51 | except: |
|
52 | 52 | return 0 |
|
53 | 53 | |
|
54 | 54 | return 1 |
|
55 | 55 | |
|
56 | 56 | class BasicWindow(QMainWindow, Ui_BasicWindow): |
|
57 | 57 | """ |
|
58 | 58 | """ |
|
59 | 59 | def __init__(self, parent=None): |
|
60 | 60 | """ |
|
61 | 61 | |
|
62 | 62 | """ |
|
63 | 63 | QMainWindow.__init__(self, parent) |
|
64 | 64 | self.setupUi(self) |
|
65 | 65 | self.__puObjDict = {} |
|
66 | 66 | self.__itemTreeDict = {} |
|
67 | 67 | self.readUnitConfObjList = [] |
|
68 | 68 | self.operObjList = [] |
|
69 | 69 | self.projecObjView = None |
|
70 | 70 | self.idProject = 0 |
|
71 | 71 | # self.idImag = 0 |
|
72 | 72 | |
|
73 | 73 | self.idImagscope = 0 |
|
74 | 74 | self.idImagspectra = 0 |
|
75 | 75 | self.idImagcross = 0 |
|
76 | 76 | self.idImagrti = 0 |
|
77 | 77 | self.idImagcoherence = 0 |
|
78 | 78 | self.idImagpower = 0 |
|
79 | 79 | self.idImagrtinoise = 0 |
|
80 | 80 | self.idImagspectraHeis = 0 |
|
81 | 81 | self.idImagrtiHeis = 0 |
|
82 | 82 | |
|
83 | 83 | self.dataPath = None |
|
84 | 84 | self.online = 0 |
|
85 | 85 | self.walk = 0 |
|
86 | 86 | self.create = False |
|
87 | 87 | self.selectedItemTree = None |
|
88 | 88 | self.controllerObj = None |
|
89 | 89 | # self.commCtrlPThread = None |
|
90 | 90 | # self.create_figure() |
|
91 | 91 | self.temporalFTP = ftpBuffer() |
|
92 | 92 | self.projectProperCaracteristica = [] |
|
93 | 93 | self.projectProperPrincipal = [] |
|
94 | 94 | self.projectProperDescripcion = [] |
|
95 | 95 | self.volProperCaracteristica = [] |
|
96 | 96 | self.volProperPrincipal = [] |
|
97 | 97 | self.volProperDescripcion = [] |
|
98 | 98 | self.specProperCaracteristica = [] |
|
99 | 99 | self.specProperPrincipal = [] |
|
100 | 100 | self.specProperDescripcion = [] |
|
101 | 101 | |
|
102 | 102 | self.specHeisProperCaracteristica = [] |
|
103 | 103 | self.specHeisProperPrincipal = [] |
|
104 | 104 | self.specHeisProperDescripcion = [] |
|
105 | 105 | |
|
106 | 106 | # self.pathWorkSpace = './' |
|
107 | 107 | |
|
108 | 108 | self.__projectObjDict = {} |
|
109 | 109 | self.__operationObjDict = {} |
|
110 | 110 | |
|
111 | 111 | self.__ftpProcUnitAdded = False |
|
112 | 112 | self.__ftpProcUnitId = None |
|
113 | 113 | self.__initialized = False |
|
114 | 114 | |
|
115 | 115 | # self.create_comm() |
|
116 | 116 | self.create_updating_timer() |
|
117 | 117 | self.setParameter() |
|
118 | 118 | |
|
119 | 119 | @pyqtSignature("") |
|
120 | 120 | def on_actionOpen_triggered(self): |
|
121 | 121 | """ |
|
122 | 122 | Slot documentation goes here. |
|
123 | 123 | """ |
|
124 | 124 | self.openProject() |
|
125 | 125 | |
|
126 | 126 | @pyqtSignature("") |
|
127 | 127 | def on_actionCreate_triggered(self): |
|
128 | 128 | """ |
|
129 | 129 | Slot documentation goes here. |
|
130 | 130 | """ |
|
131 | 131 | self.setInputsProject_View() |
|
132 | 132 | self.create = True |
|
133 | 133 | |
|
134 | 134 | @pyqtSignature("") |
|
135 | 135 | def on_actionSave_triggered(self): |
|
136 | 136 | """ |
|
137 | 137 | Slot documentation goes here. |
|
138 | 138 | """ |
|
139 | 139 | self.saveProject() |
|
140 | 140 | |
|
141 | 141 | @pyqtSignature("") |
|
142 | 142 | def on_actionClose_triggered(self): |
|
143 | 143 | """ |
|
144 | 144 | Slot documentation goes here. |
|
145 | 145 | """ |
|
146 | 146 | self.close() |
|
147 | 147 | |
|
148 | 148 | @pyqtSignature("") |
|
149 | 149 | def on_actionStart_triggered(self): |
|
150 | 150 | """ |
|
151 | 151 | """ |
|
152 | 152 | self.playProject() |
|
153 | 153 | |
|
154 | 154 | @pyqtSignature("") |
|
155 | 155 | def on_actionPause_triggered(self): |
|
156 | 156 | """ |
|
157 | 157 | """ |
|
158 | 158 | self.pauseProject() |
|
159 | 159 | |
|
160 | 160 | @pyqtSignature("") |
|
161 | 161 | def on_actionStop_triggered(self): |
|
162 | 162 | """ |
|
163 | 163 | """ |
|
164 | 164 | self.stopProject() |
|
165 | 165 | |
|
166 | 166 | @pyqtSignature("") |
|
167 | 167 | def on_actionFTP_triggered(self): |
|
168 | 168 | """ |
|
169 | 169 | """ |
|
170 | 170 | self.configFTPWindowObj = Ftp(self) |
|
171 | 171 | # if self.temporalFTP.create: |
|
172 | 172 | if self.temporalFTP.createforView: |
|
173 | 173 | server, folder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.temporalFTP.recover() |
|
174 | 174 | self.configFTPWindowObj.setParmsfromTemporal(server, folder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos) |
|
175 | 175 | self.configFTPWindowObj.show() |
|
176 | 176 | self.configFTPWindowObj.closed.connect(self.createFTPConfig) |
|
177 | 177 | |
|
178 | 178 | def createFTPConfig(self): |
|
179 | 179 | |
|
180 | 180 | if not self.configFTPWindowObj.create: |
|
181 | 181 | self.console.clear() |
|
182 | 182 | self.console.append("There is no FTP configuration") |
|
183 | 183 | return |
|
184 | 184 | self.console.append("Push Ok in Spectra view to Add FTP Configuration") |
|
185 | 185 | server, folder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.configFTPWindowObj.getParmsFromFtpWindow() |
|
186 | 186 | self.temporalFTP.save(server, folder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos) |
|
187 | 187 | |
|
188 | 188 | @pyqtSignature("") |
|
189 | 189 | def on_actionOpenToolbar_triggered(self): |
|
190 | 190 | """ |
|
191 | 191 | Slot documentation goes here. |
|
192 | 192 | """ |
|
193 | 193 | self.openProject() |
|
194 | 194 | |
|
195 | 195 | @pyqtSignature("") |
|
196 | 196 | def on_actionCreateToolbar_triggered(self): |
|
197 | 197 | """ |
|
198 | 198 | Slot documentation goes here. |
|
199 | 199 | """ |
|
200 | 200 | self.setInputsProject_View() |
|
201 | 201 | self.create = True |
|
202 | 202 | |
|
203 | 203 | @pyqtSignature("") |
|
204 | 204 | def on_actionAddPU_triggered(self): |
|
205 | 205 | if len(self.__projectObjDict) == 0: |
|
206 | 206 | outputstr = "First Create a Project then add Processing Unit" |
|
207 | 207 | self.console.clear() |
|
208 | 208 | self.console.append(outputstr) |
|
209 | 209 | return 0 |
|
210 | 210 | else: |
|
211 | 211 | self.addPUWindow() |
|
212 | 212 | self.console.clear() |
|
213 | 213 | self.console.append("Please, Choose the type of Processing Unit") |
|
214 | 214 | self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
215 | 215 | self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
216 | 216 | self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
217 | 217 | |
|
218 | 218 | |
|
219 | 219 | @pyqtSignature("") |
|
220 | 220 | def on_actionSaveToolbar_triggered(self): |
|
221 | 221 | """ |
|
222 | 222 | Slot documentation goes here. |
|
223 | 223 | """ |
|
224 | 224 | self.saveProject() |
|
225 | 225 | |
|
226 | 226 | @pyqtSignature("") |
|
227 | 227 | def on_actionStarToolbar_triggered(self): |
|
228 | 228 | """ |
|
229 | 229 | Slot documentation goes here. |
|
230 | 230 | """ |
|
231 | 231 | self.playProject() |
|
232 | 232 | |
|
233 | 233 | @pyqtSignature("") |
|
234 | 234 | def on_actionPauseToolbar_triggered(self): |
|
235 | 235 | |
|
236 | 236 | self.pauseProject() |
|
237 | 237 | |
|
238 | 238 | @pyqtSignature("") |
|
239 | 239 | def on_actionStopToolbar_triggered(self): |
|
240 | 240 | """ |
|
241 | 241 | Slot documentation goes here. |
|
242 | 242 | """ |
|
243 | 243 | self.stopProject() |
|
244 | 244 | |
|
245 | 245 | @pyqtSignature("int") |
|
246 | 246 | def on_proComReadMode_activated(self, index): |
|
247 | 247 | """ |
|
248 | 248 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 |
|
249 | 249 | """ |
|
250 | 250 | if index == 0: |
|
251 | 251 | self.online = 0 |
|
252 | 252 | self.proDelay.setText("0") |
|
253 | 253 | self.proSet.setText("") |
|
254 | 254 | self.proSet.setEnabled(False) |
|
255 | 255 | self.proDelay.setEnabled(False) |
|
256 | 256 | elif index == 1: |
|
257 | 257 | self.online = 1 |
|
258 | 258 | self.proSet.setText(" ") |
|
259 | 259 | self.proDelay.setText("5") |
|
260 | 260 | self.proSet.setEnabled(True) |
|
261 | 261 | self.proDelay.setEnabled(True) |
|
262 | 262 | |
|
263 | 263 | @pyqtSignature("int") |
|
264 | 264 | def on_proComDataType_activated(self, index): |
|
265 | 265 | """ |
|
266 | 266 | Voltage or Spectra |
|
267 | 267 | """ |
|
268 | 268 | self.labelSet.show() |
|
269 | 269 | self.proSet.show() |
|
270 | 270 | |
|
271 | 271 | self.labelIPPKm.hide() |
|
272 | 272 | self.proIPPKm.hide() |
|
273 | 273 | |
|
274 | 274 | if index == 0: |
|
275 | 275 | extension = '.r' |
|
276 | 276 | elif index == 1: |
|
277 | 277 | extension = '.pdata' |
|
278 | 278 | elif index == 2: |
|
279 | 279 | extension = '.fits' |
|
280 | 280 | elif index == 3: |
|
281 | 281 | extension = '.hdf5' |
|
282 | 282 | |
|
283 | 283 | self.labelSet.hide() |
|
284 | 284 | self.proSet.hide() |
|
285 | 285 | self.labelIPPKm.show() |
|
286 | 286 | self.proIPPKm.show() |
|
287 | 287 | |
|
288 | 288 | self.proDataType.setText(extension) |
|
289 | 289 | |
|
290 | 290 | @pyqtSignature("int") |
|
291 | 291 | def on_proComWalk_activated(self, index): |
|
292 | 292 | """ |
|
293 | 293 | |
|
294 | 294 | """ |
|
295 | 295 | if index == 0: |
|
296 | 296 | self.walk = 0 |
|
297 | 297 | elif index == 1: |
|
298 | 298 | self.walk = 1 |
|
299 | 299 | |
|
300 | 300 | @pyqtSignature("") |
|
301 | 301 | def on_proToolPath_clicked(self): |
|
302 | 302 | """ |
|
303 | 303 | Choose your path |
|
304 | 304 | """ |
|
305 | 305 | |
|
306 | 306 | current_dpath = './' |
|
307 | 307 | if self.dataPath: |
|
308 | 308 | current_dpath = self.dataPath |
|
309 | 309 | |
|
310 | 310 | datapath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', current_dpath, QtGui.QFileDialog.ShowDirsOnly)) |
|
311 | 311 | |
|
312 | 312 | #If it was canceled |
|
313 | 313 | if not datapath: |
|
314 | 314 | return |
|
315 | 315 | |
|
316 | 316 | #If any change was done |
|
317 | 317 | if datapath == self.dataPath: |
|
318 | 318 | return |
|
319 | 319 | |
|
320 | 320 | self.proDataPath.setText(datapath) |
|
321 | 321 | |
|
322 | 322 | self.actionStart.setEnabled(False) |
|
323 | 323 | self.actionStarToolbar.setEnabled(False) |
|
324 | 324 | self.proOk.setEnabled(False) |
|
325 | 325 | |
|
326 | 326 | self.proComStartDate.clear() |
|
327 | 327 | self.proComEndDate.clear() |
|
328 | 328 | |
|
329 | 329 | if not os.path.exists(datapath): |
|
330 | 330 | |
|
331 | 331 | self.console.clear() |
|
332 | 332 | self.console.append("Write a correct a path") |
|
333 | 333 | return |
|
334 | 334 | |
|
335 | 335 | self.dataPath = datapath |
|
336 | 336 | |
|
337 | 337 | self.console.clear() |
|
338 | 338 | self.console.append("Select the read mode and press 'load button'") |
|
339 | 339 | |
|
340 | 340 | |
|
341 | 341 | @pyqtSignature("") |
|
342 | 342 | def on_proLoadButton_clicked(self): |
|
343 | 343 | |
|
344 | 344 | self.console.clear() |
|
345 | 345 | |
|
346 | 346 | parameter_list = self.checkInputsProject() |
|
347 | 347 | |
|
348 | 348 | if not parameter_list[0]: |
|
349 | 349 | return |
|
350 | 350 | |
|
351 | 351 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set = parameter_list |
|
352 | 352 | |
|
353 | 353 | if read_mode == "Offline": |
|
354 | 354 | self.proComStartDate.clear() |
|
355 | 355 | self.proComEndDate.clear() |
|
356 | 356 | self.proComStartDate.setEnabled(True) |
|
357 | 357 | self.proComEndDate.setEnabled(True) |
|
358 | 358 | self.proStartTime.setEnabled(True) |
|
359 | 359 | self.proEndTime.setEnabled(True) |
|
360 | 360 | self.frame_2.setEnabled(True) |
|
361 | 361 | |
|
362 | 362 | if read_mode == "Online": |
|
363 | 363 | self.proComStartDate.addItem("2000/01/30") |
|
364 | 364 | self.proComEndDate.addItem("2016/12/31") |
|
365 | 365 | self.proComStartDate.setEnabled(False) |
|
366 | 366 | self.proComEndDate.setEnabled(False) |
|
367 | 367 | self.proStartTime.setEnabled(False) |
|
368 | 368 | self.proEndTime.setEnabled(False) |
|
369 | 369 | self.frame_2.setEnabled(True) |
|
370 | 370 | |
|
371 | 371 | self.loadDays(data_path, ext, walk) |
|
372 | 372 | |
|
373 | 373 | @pyqtSignature("int") |
|
374 | 374 | def on_proComStartDate_activated(self, index): |
|
375 | 375 | """ |
|
376 | 376 | SELECCION DEL RANGO DE FECHAS -START DATE |
|
377 | 377 | """ |
|
378 | 378 | stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex() |
|
379 | 379 | self.proComEndDate.clear() |
|
380 | 380 | for i in self.dateList[index:]: |
|
381 | 381 | self.proComEndDate.addItem(i) |
|
382 | 382 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex) |
|
383 | 383 | |
|
384 | 384 | @pyqtSignature("int") |
|
385 | 385 | def on_proComEndDate_activated(self, index): |
|
386 | 386 | """ |
|
387 | 387 | SELECCION DEL RANGO DE FECHAS-END DATE |
|
388 | 388 | """ |
|
389 | 389 | startIndex = self.proComStartDate.currentIndex() |
|
390 | 390 | stopIndex = self.proComEndDate.count() - index |
|
391 | 391 | self.proComStartDate.clear() |
|
392 | 392 | for i in self.dateList[:len(self.dateList) - stopIndex + 1]: |
|
393 | 393 | self.proComStartDate.addItem(i) |
|
394 | 394 | self.proComStartDate.setCurrentIndex(startIndex) |
|
395 | 395 | |
|
396 | 396 | @pyqtSignature("") |
|
397 | 397 | def on_proOk_clicked(self): |
|
398 | 398 | """ |
|
399 | 399 | AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. |
|
400 | 400 | Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2 |
|
401 | 401 | """ |
|
402 | 402 | |
|
403 | 403 | self.actionStart.setEnabled(False) |
|
404 | 404 | self.actionStarToolbar.setEnabled(False) |
|
405 | 405 | |
|
406 | 406 | if self.create: |
|
407 | 407 | |
|
408 | 408 | projectId = self.__getNewProjectId() |
|
409 | 409 | |
|
410 | 410 | if not projectId: |
|
411 | 411 | return 0 |
|
412 | 412 | |
|
413 | 413 | projectObjView = self.createProjectView(projectId) |
|
414 | 414 | |
|
415 | 415 | if not projectObjView: |
|
416 | 416 | return 0 |
|
417 | 417 | |
|
418 | 418 | readUnitObj = self.createReadUnitView(projectObjView) |
|
419 | 419 | |
|
420 | 420 | if not readUnitObj: |
|
421 | 421 | return 0 |
|
422 | 422 | |
|
423 | 423 | else: |
|
424 | 424 | projectObjView = self.updateProjectView() |
|
425 | 425 | |
|
426 | 426 | if not projectObjView: |
|
427 | 427 | return 0 |
|
428 | 428 | |
|
429 | 429 | projectId = projectObjView.getId() |
|
430 | 430 | idReadUnit = projectObjView.getReadUnitId() |
|
431 | 431 | readUnitObj = self.updateReadUnitView(projectObjView, idReadUnit) |
|
432 | 432 | |
|
433 | 433 | if not readUnitObj: |
|
434 | 434 | return 0 |
|
435 | 435 | |
|
436 | 436 | self.__itemTreeDict[projectId].setText(projectObjView.name) |
|
437 | 437 | # Project Properties |
|
438 | 438 | self.refreshProjectProperties(projectObjView) |
|
439 | 439 | # Disable tabProject after finish the creation |
|
440 | 440 | |
|
441 | 441 | self.actionStart.setEnabled(True) |
|
442 | 442 | self.actionStarToolbar.setEnabled(True) |
|
443 | 443 | self.console.clear() |
|
444 | 444 | self.console.append("The project parameters were validated") |
|
445 | 445 | |
|
446 | 446 | return 1 |
|
447 | 447 | |
|
448 | 448 | @pyqtSignature("") |
|
449 | 449 | def on_proClear_clicked(self): |
|
450 | 450 | |
|
451 | 451 | self.console.clear() |
|
452 | 452 | |
|
453 | 453 | @pyqtSignature("int") |
|
454 | 454 | def on_volOpCebChannels_stateChanged(self, p0): |
|
455 | 455 | """ |
|
456 | 456 | Check Box habilita operaciones de SelecciοΏ½n de Canales |
|
457 | 457 | """ |
|
458 | 458 | if p0 == 2: |
|
459 | 459 | self.volOpComChannels.setEnabled(True) |
|
460 | 460 | self.volOpChannel.setEnabled(True) |
|
461 | 461 | |
|
462 | 462 | if p0 == 0: |
|
463 | 463 | self.volOpComChannels.setEnabled(False) |
|
464 | 464 | self.volOpChannel.setEnabled(False) |
|
465 | 465 | self.volOpChannel.clear() |
|
466 | 466 | |
|
467 | 467 | @pyqtSignature("int") |
|
468 | 468 | def on_volOpCebHeights_stateChanged(self, p0): |
|
469 | 469 | """ |
|
470 | 470 | Check Box habilita operaciones de SelecciοΏ½n de Alturas |
|
471 | 471 | """ |
|
472 | 472 | if p0 == 2: |
|
473 | 473 | self.volOpHeights.setEnabled(True) |
|
474 | 474 | self.volOpComHeights.setEnabled(True) |
|
475 | 475 | |
|
476 | 476 | if p0 == 0: |
|
477 | 477 | self.volOpHeights.setEnabled(False) |
|
478 | 478 | self.volOpHeights.clear() |
|
479 | 479 | self.volOpComHeights.setEnabled(False) |
|
480 | 480 | |
|
481 | 481 | @pyqtSignature("int") |
|
482 | 482 | def on_volOpCebFilter_stateChanged(self, p0): |
|
483 | 483 | """ |
|
484 | 484 | Name='Decoder', optype='other' |
|
485 | 485 | """ |
|
486 | 486 | if p0 == 2: |
|
487 | 487 | self.volOpFilter.setEnabled(True) |
|
488 | 488 | |
|
489 | 489 | if p0 == 0: |
|
490 | 490 | self.volOpFilter.setEnabled(False) |
|
491 | 491 | self.volOpFilter.clear() |
|
492 | 492 | |
|
493 | 493 | @pyqtSignature("int") |
|
494 | 494 | def on_volOpCebProfile_stateChanged(self, p0): |
|
495 | 495 | """ |
|
496 | 496 | Check Box habilita ingreso del rango de Perfiles |
|
497 | 497 | """ |
|
498 | 498 | if p0 == 2: |
|
499 | 499 | self.volOpComProfile.setEnabled(True) |
|
500 | 500 | self.volOpProfile.setEnabled(True) |
|
501 | 501 | |
|
502 | 502 | if p0 == 0: |
|
503 | 503 | self.volOpComProfile.setEnabled(False) |
|
504 | 504 | self.volOpProfile.setEnabled(False) |
|
505 | 505 | self.volOpProfile.clear() |
|
506 | 506 | |
|
507 | 507 | @pyqtSignature("int") |
|
508 | 508 | def on_volOpComProfile_activated(self, index): |
|
509 | 509 | """ |
|
510 | 510 | Check Box habilita ingreso del rango de Perfiles |
|
511 | 511 | """ |
|
512 | 512 | #Profile List |
|
513 | 513 | if index == 0: |
|
514 | 514 | self.volOpProfile.setToolTip('List of selected profiles. Example: 0, 1, 2, 3, 4, 5, 6, 7') |
|
515 | 515 | |
|
516 | 516 | #Profile Range |
|
517 | 517 | if index == 1: |
|
518 | 518 | self.volOpProfile.setToolTip('Minimum and maximum profile index. Example: 0, 7') |
|
519 | 519 | |
|
520 | 520 | #Profile Range List |
|
521 | 521 | if index == 2: |
|
522 | 522 | self.volOpProfile.setToolTip('List of profile ranges. Example: (0, 7), (12, 19), (100, 200)') |
|
523 | 523 | |
|
524 | 524 | @pyqtSignature("int") |
|
525 | 525 | def on_volOpCebDecodification_stateChanged(self, p0): |
|
526 | 526 | """ |
|
527 | 527 | Check Box habilita |
|
528 | 528 | """ |
|
529 | 529 | if p0 == 2: |
|
530 | 530 | self.volOpComCode.setEnabled(True) |
|
531 | 531 | self.volOpComMode.setEnabled(True) |
|
532 | 532 | if p0 == 0: |
|
533 | 533 | self.volOpComCode.setEnabled(False) |
|
534 | 534 | self.volOpComMode.setEnabled(False) |
|
535 | 535 | |
|
536 | 536 | @pyqtSignature("int") |
|
537 | 537 | def on_volOpComCode_activated(self, index): |
|
538 | 538 | """ |
|
539 | 539 | Check Box habilita ingreso |
|
540 | 540 | """ |
|
541 | 541 | if index == 13: |
|
542 | 542 | self.volOpCode.setEnabled(True) |
|
543 | 543 | else: |
|
544 | 544 | self.volOpCode.setEnabled(False) |
|
545 | 545 | |
|
546 | 546 | if index == 0: |
|
547 | 547 | code = '' |
|
548 | 548 | self.volOpCode.setText(str(code)) |
|
549 | 549 | return |
|
550 | 550 | |
|
551 | 551 | if index == 1: |
|
552 | 552 | code = '(1,1,-1)' |
|
553 | 553 | nCode = '1' |
|
554 | 554 | nBaud = '3' |
|
555 | 555 | if index == 2: |
|
556 | 556 | code = '(1,1,-1,1)' |
|
557 | 557 | nCode = '1' |
|
558 | 558 | nBaud = '4' |
|
559 | 559 | if index == 3: |
|
560 | 560 | code = '(1,1,1,-1,1)' |
|
561 | 561 | nCode = '1' |
|
562 | 562 | nBaud = '5' |
|
563 | 563 | if index == 4: |
|
564 | 564 | code = '(1,1,1,-1,-1,1,-1)' |
|
565 | 565 | nCode = '1' |
|
566 | 566 | nBaud = '7' |
|
567 | 567 | if index == 5: |
|
568 | 568 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1)' |
|
569 | 569 | nCode = '1' |
|
570 | 570 | nBaud = '11' |
|
571 | 571 | if index == 6: |
|
572 | 572 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)' |
|
573 | 573 | nCode = '1' |
|
574 | 574 | nBaud = '13' |
|
575 | 575 | if index == 7: |
|
576 | 576 | code = '(1,1,-1,-1,-1,1)' |
|
577 | 577 | nCode = '2' |
|
578 | 578 | nBaud = '3' |
|
579 | 579 | if index == 8: |
|
580 | 580 | code = '(1,1,-1,1,-1,-1,1,-1)' |
|
581 | 581 | nCode = '2' |
|
582 | 582 | nBaud = '4' |
|
583 | 583 | if index == 9: |
|
584 | 584 | code = '(1,1,1,-1,1,-1,-1,-1,1,-1)' |
|
585 | 585 | nCode = '2' |
|
586 | 586 | nBaud = '5' |
|
587 | 587 | if index == 10: |
|
588 | 588 | code = '(1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1)' |
|
589 | 589 | nCode = '2' |
|
590 | 590 | nBaud = '7' |
|
591 | 591 | if index == 11: |
|
592 | 592 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1 ,-1 ,-1 ,1 ,1,1,-1 ,1 ,1 ,-1 ,1)' |
|
593 | 593 | nCode = '2' |
|
594 | 594 | nBaud = '11' |
|
595 | 595 | if index == 12: |
|
596 | 596 | 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)' |
|
597 | 597 | nCode = '2' |
|
598 | 598 | nBaud = '13' |
|
599 | 599 | |
|
600 | 600 | code = ast.literal_eval(code) |
|
601 | 601 | nCode = int(nCode) |
|
602 | 602 | nBaud = int(nBaud) |
|
603 | 603 | |
|
604 | 604 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
605 | 605 | |
|
606 | 606 | self.volOpCode.setText(str(code)) |
|
607 | 607 | |
|
608 | 608 | @pyqtSignature("int") |
|
609 | 609 | def on_volOpCebFlip_stateChanged(self, p0): |
|
610 | 610 | """ |
|
611 | 611 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
612 | 612 | """ |
|
613 | 613 | if p0 == 2: |
|
614 | 614 | self.volOpFlip.setEnabled(True) |
|
615 | 615 | if p0 == 0: |
|
616 | 616 | self.volOpFlip.setEnabled(False) |
|
617 | 617 | self.volOpFlip.clear() |
|
618 | 618 | |
|
619 | 619 | @pyqtSignature("int") |
|
620 | 620 | def on_volOpCebCohInt_stateChanged(self, p0): |
|
621 | 621 | """ |
|
622 | 622 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
623 | 623 | """ |
|
624 | 624 | if p0 == 2: |
|
625 | 625 | self.volOpCohInt.setEnabled(True) |
|
626 | 626 | if p0 == 0: |
|
627 | 627 | self.volOpCohInt.setEnabled(False) |
|
628 | 628 | self.volOpCohInt.clear() |
|
629 | 629 | |
|
630 | 630 | @pyqtSignature("int") |
|
631 | 631 | def on_volOpCebRadarfrequency_stateChanged(self, p0): |
|
632 | 632 | """ |
|
633 | 633 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
634 | 634 | """ |
|
635 | 635 | if p0 == 2: |
|
636 | 636 | self.volOpRadarfrequency.setEnabled(True) |
|
637 | 637 | if p0 == 0: |
|
638 | 638 | self.volOpRadarfrequency.clear() |
|
639 | 639 | self.volOpRadarfrequency.setEnabled(False) |
|
640 | 640 | |
|
641 | 641 | @pyqtSignature("") |
|
642 | 642 | def on_volOutputToolPath_clicked(self): |
|
643 | 643 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
644 | 644 | self.volOutputPath.setText(dirOutPath) |
|
645 | 645 | |
|
646 | 646 | @pyqtSignature("") |
|
647 | 647 | def on_specOutputToolPath_clicked(self): |
|
648 | 648 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
649 | 649 | self.specOutputPath.setText(dirOutPath) |
|
650 | 650 | |
|
651 | 651 | @pyqtSignature("") |
|
652 | 652 | def on_specHeisOutputToolPath_clicked(self): |
|
653 | 653 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
654 | 654 | self.specHeisOutputPath.setText(dirOutPath) |
|
655 | 655 | |
|
656 | 656 | @pyqtSignature("") |
|
657 | 657 | def on_specHeisOutputMetadaToolPath_clicked(self): |
|
658 | 658 | |
|
659 | 659 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
660 | 660 | self.specHeisOutputMetada.setText(filename) |
|
661 | 661 | |
|
662 | 662 | @pyqtSignature("") |
|
663 | 663 | def on_volOpOk_clicked(self): |
|
664 | 664 | """ |
|
665 | 665 | BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO |
|
666 | 666 | PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML |
|
667 | 667 | """ |
|
668 | 668 | |
|
669 | 669 | checkPath = False |
|
670 | 670 | |
|
671 | 671 | self.actionSaveToolbar.setEnabled(False) |
|
672 | 672 | self.actionStarToolbar.setEnabled(False) |
|
673 | 673 | |
|
674 | 674 | puObj = self.getSelectedItemObj() |
|
675 | 675 | puObj.removeOperations() |
|
676 | 676 | |
|
677 | 677 | if self.volOpCebRadarfrequency.isChecked(): |
|
678 | 678 | value = str(self.volOpRadarfrequency.text()) |
|
679 | 679 | format = 'float' |
|
680 | 680 | name_operation = 'setRadarFrequency' |
|
681 | 681 | name_parameter = 'frequency' |
|
682 | 682 | if not value == "": |
|
683 | 683 | try: |
|
684 | 684 | radarfreq = float(self.volOpRadarfrequency.text()) |
|
685 | 685 | except: |
|
686 | 686 | self.console.clear() |
|
687 | 687 | self.console.append("Write the parameter Radar Frequency type float") |
|
688 | 688 | return 0 |
|
689 | 689 | opObj = puObj.addOperation(name=name_operation) |
|
690 | 690 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
691 | 691 | |
|
692 | 692 | if self.volOpCebChannels.isChecked(): |
|
693 | 693 | value = str(self.volOpChannel.text()) |
|
694 | 694 | |
|
695 | 695 | if value == "": |
|
696 | 696 | print "Please fill channel list" |
|
697 | 697 | return 0 |
|
698 | 698 | |
|
699 | 699 | format = 'intlist' |
|
700 | 700 | if self.volOpComChannels.currentIndex() == 0: |
|
701 | 701 | name_operation = "selectChannels" |
|
702 | 702 | name_parameter = 'channelList' |
|
703 | 703 | else: |
|
704 | 704 | name_operation = "selectChannelsByIndex" |
|
705 | 705 | name_parameter = 'channelIndexList' |
|
706 | 706 | |
|
707 | 707 | opObj = puObj.addOperation(name=name_operation) |
|
708 | 708 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
709 | 709 | |
|
710 | 710 | if self.volOpCebHeights.isChecked(): |
|
711 | 711 | value = str(self.volOpHeights.text()) |
|
712 | 712 | |
|
713 | 713 | if value == "": |
|
714 | 714 | print "Please fill height range" |
|
715 | 715 | return 0 |
|
716 | 716 | |
|
717 | 717 | valueList = value.split(',') |
|
718 | 718 | format = 'float' |
|
719 | 719 | if self.volOpComHeights.currentIndex() == 0: |
|
720 | 720 | name_operation = 'selectHeights' |
|
721 | 721 | name_parameter1 = 'minHei' |
|
722 | 722 | name_parameter2 = 'maxHei' |
|
723 | 723 | else: |
|
724 | 724 | name_operation = 'selectHeightsByIndex' |
|
725 | 725 | name_parameter1 = 'minIndex' |
|
726 | 726 | name_parameter2 = 'maxIndex' |
|
727 | 727 | |
|
728 | 728 | opObj = puObj.addOperation(name=name_operation) |
|
729 | 729 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) |
|
730 | 730 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) |
|
731 | 731 | |
|
732 | 732 | if self.volOpCebFilter.isChecked(): |
|
733 | 733 | value = str(self.volOpFilter.text()) |
|
734 | 734 | if value == "": |
|
735 | 735 | print "Please fill filter value" |
|
736 | 736 | return 0 |
|
737 | 737 | |
|
738 | 738 | format = 'int' |
|
739 | 739 | name_operation = 'filterByHeights' |
|
740 | 740 | name_parameter = 'window' |
|
741 | 741 | opObj = puObj.addOperation(name=name_operation) |
|
742 | 742 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
743 | 743 | |
|
744 | 744 | if self.volOpCebProfile.isChecked(): |
|
745 | 745 | value = str(self.volOpProfile.text()) |
|
746 | 746 | |
|
747 | 747 | if value == "": |
|
748 | 748 | print "Please fill profile value" |
|
749 | 749 | return 0 |
|
750 | 750 | |
|
751 | 751 | format = 'intlist' |
|
752 | 752 | optype = 'other' |
|
753 | 753 | name_operation = 'ProfileSelector' |
|
754 | 754 | if self.volOpComProfile.currentIndex() == 0: |
|
755 | 755 | name_parameter = 'profileList' |
|
756 | 756 | if self.volOpComProfile.currentIndex() == 1: |
|
757 | 757 | name_parameter = 'profileRangeList' |
|
758 | 758 | if self.volOpComProfile.currentIndex() == 2: |
|
759 | 759 | name_parameter = 'rangeList' |
|
760 | 760 | |
|
761 | 761 | opObj = puObj.addOperation(name='ProfileSelector', optype='other') |
|
762 | 762 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
763 | 763 | |
|
764 | 764 | if self.volOpCebDecodification.isChecked(): |
|
765 | 765 | |
|
766 | 766 | if self.volOpComMode.currentIndex() == 0: |
|
767 | 767 | mode = '0' |
|
768 | 768 | if self.volOpComMode.currentIndex() == 1: |
|
769 | 769 | mode = '1' |
|
770 | 770 | if self.volOpComMode.currentIndex() == 2: |
|
771 | 771 | mode = '2' |
|
772 | 772 | |
|
773 | 773 | if self.volOpComCode.currentIndex() == 0: |
|
774 | 774 | opObj = puObj.addOperation(name='Decoder', optype='other') |
|
775 | 775 | opObj.addParameter(name='mode', value=mode, format='int') |
|
776 | 776 | else: |
|
777 | 777 | #User defined |
|
778 | 778 | code = str(self.volOpCode.text()) |
|
779 | 779 | try: |
|
780 | 780 | code_tmp = ast.literal_eval(code) |
|
781 | 781 | except: |
|
782 | 782 | code_tmp = [] |
|
783 | 783 | |
|
784 | 784 | if len(code_tmp) < 1: |
|
785 | 785 | self.console.append("Please fill the code value") |
|
786 | 786 | return 0 |
|
787 | 787 | |
|
788 | 788 | if len(code_tmp) == 1 or type(code_tmp[0]) != int: |
|
789 | 789 | nBaud = len(code_tmp[0]) |
|
790 | 790 | nCode = len(code_tmp) |
|
791 | 791 | else: |
|
792 | 792 | nBaud = len(code_tmp) |
|
793 | 793 | nCode = 1 |
|
794 | 794 | |
|
795 | 795 | opObj = puObj.addOperation(name='Decoder', optype='other') |
|
796 | 796 | |
|
797 | 797 | code = code.replace("(", "") |
|
798 | 798 | code = code.replace(")", "") |
|
799 | 799 | code = code.replace("[", "") |
|
800 | 800 | code = code.replace("]", "") |
|
801 | 801 | opObj.addParameter(name='code', value=code, format='intlist') |
|
802 | 802 | opObj.addParameter(name='nCode', value=nCode, format='int') |
|
803 | 803 | opObj.addParameter(name='nBaud', value=nBaud, format='int') |
|
804 | 804 | opObj.addParameter(name='mode', value=mode, format='int') |
|
805 | 805 | |
|
806 | 806 | if self.volOpCebFlip.isChecked(): |
|
807 | 807 | name_operation = 'deFlip' |
|
808 | 808 | optype = 'self' |
|
809 | 809 | value = str(self.volOpFlip.text()) |
|
810 | 810 | name_parameter = 'channelList' |
|
811 | 811 | format = 'intlist' |
|
812 | 812 | |
|
813 | 813 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
814 | 814 | if value: |
|
815 | 815 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
816 | 816 | |
|
817 | 817 | if self.volOpCebCohInt.isChecked(): |
|
818 | 818 | name_operation = 'CohInt' |
|
819 | 819 | optype = 'other' |
|
820 | 820 | value = str(self.volOpCohInt.text()) |
|
821 | 821 | |
|
822 | 822 | if value == "": |
|
823 | 823 | print "Please fill number of coherent integrations" |
|
824 | 824 | return 0 |
|
825 | 825 | |
|
826 | 826 | name_parameter = 'n' |
|
827 | 827 | format = 'float' |
|
828 | 828 | |
|
829 | 829 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
830 | 830 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
831 | 831 | |
|
832 | 832 | if self.volGraphCebshow.isChecked(): |
|
833 | 833 | name_operation = 'Scope' |
|
834 | 834 | optype = 'other' |
|
835 | 835 | name_parameter = 'type' |
|
836 | 836 | value = 'Scope' |
|
837 | 837 | if self.idImagscope == 0: |
|
838 | 838 | self.idImagscope = 100 |
|
839 | 839 | else: |
|
840 | 840 | self.idImagscope = self.idImagscope + 1 |
|
841 | 841 | |
|
842 | 842 | name_parameter1 = 'id' |
|
843 | 843 | value1 = int(self.idImagscope) |
|
844 | 844 | format1 = 'int' |
|
845 | 845 | format = 'str' |
|
846 | 846 | |
|
847 | 847 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
848 | 848 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
849 | 849 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) |
|
850 | 850 | |
|
851 | 851 | channelList = str(self.volGraphChannelList.text()).replace(" ","") |
|
852 | 852 | xvalue = str(self.volGraphfreqrange.text()).replace(" ","") |
|
853 | 853 | yvalue = str(self.volGraphHeightrange.text()).replace(" ","") |
|
854 | 854 | |
|
855 | 855 | if channelList: |
|
856 | 856 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
857 | 857 | |
|
858 | 858 | if xvalue: |
|
859 | 859 | xvalueList = xvalue.split(',') |
|
860 | 860 | try: |
|
861 | 861 | value0 = float(xvalueList[0]) |
|
862 | 862 | value1 = float(xvalueList[1]) |
|
863 | 863 | except: |
|
864 | 864 | return 0 |
|
865 | 865 | opObj.addParameter(name='xmin', value=value0, format='float') |
|
866 | 866 | opObj.addParameter(name='xmax', value=value1, format='float') |
|
867 | 867 | |
|
868 | 868 | |
|
869 | 869 | if not yvalue == "": |
|
870 | 870 | yvalueList = yvalue.split(",") |
|
871 | 871 | try: |
|
872 | 872 | value0 = int(yvalueList[0]) |
|
873 | 873 | value1 = int(yvalueList[1]) |
|
874 | 874 | except: |
|
875 | 875 | return 0 |
|
876 | 876 | |
|
877 | 877 | opObj.addParameter(name='ymin', value=value0, format='int') |
|
878 | 878 | opObj.addParameter(name='ymax', value=value1, format='int') |
|
879 | 879 | |
|
880 | 880 | if self.volGraphCebSave.isChecked(): |
|
881 | 881 | checkPath = True |
|
882 | 882 | opObj.addParameter(name='save', value='1', format='int') |
|
883 | 883 | opObj.addParameter(name='figpath', value=self.volGraphPath.text(), format='str') |
|
884 | 884 | value = str(self.volGraphPrefix.text()).replace(" ","") |
|
885 | 885 | if value: |
|
886 | 886 | opObj.addParameter(name='figfile', value=value, format='str') |
|
887 | 887 | |
|
888 | 888 | localfolder = None |
|
889 | 889 | if checkPath: |
|
890 | 890 | localfolder = str(self.volGraphPath.text()) |
|
891 | 891 | if localfolder == '': |
|
892 | 892 | self.console.clear() |
|
893 | 893 | self.console.append("Graphic path should be defined") |
|
894 | 894 | return 0 |
|
895 | 895 | |
|
896 | 896 | # if something happend |
|
897 | 897 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Voltage') |
|
898 | 898 | if parms_ok: |
|
899 | 899 | name_operation = 'VoltageWriter' |
|
900 | 900 | optype = 'other' |
|
901 | 901 | name_parameter1 = 'path' |
|
902 | 902 | name_parameter2 = 'blocksPerFile' |
|
903 | 903 | name_parameter3 = 'profilesPerBlock' |
|
904 | 904 | value1 = output_path |
|
905 | 905 | value2 = blocksperfile |
|
906 | 906 | value3 = profilesperblock |
|
907 | 907 | format = "int" |
|
908 | 908 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
909 | 909 | opObj.addParameter(name=name_parameter1, value=value1) |
|
910 | 910 | opObj.addParameter(name=name_parameter2, value=value2, format=format) |
|
911 | 911 | opObj.addParameter(name=name_parameter3, value=value3, format=format) |
|
912 | ||
|
913 | #---------NEW VOLTAGE PROPERTIES | |
|
914 | self.refreshPUProperties(puObj) | |
|
915 | ||
|
912 | ||
|
916 | 913 | self.console.clear() |
|
914 | try: | |
|
915 | self.refreshPUProperties(puObj) | |
|
916 | except: | |
|
917 | self.console.append("Check input parameters") | |
|
918 | return 0 | |
|
919 | ||
|
917 | 920 | self.console.append("If you want to save your project") |
|
918 | 921 | self.console.append("click on your project name in the Tree Project Explorer") |
|
919 | 922 | |
|
920 | 923 | self.actionSaveToolbar.setEnabled(True) |
|
921 | 924 | self.actionStarToolbar.setEnabled(True) |
|
922 | 925 | |
|
923 | 926 | return 1 |
|
924 | 927 | |
|
925 | 928 | """ |
|
926 | 929 | Voltage Graph |
|
927 | 930 | """ |
|
928 | 931 | @pyqtSignature("int") |
|
929 | 932 | def on_volGraphCebSave_stateChanged(self, p0): |
|
930 | 933 | """ |
|
931 | 934 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
932 | 935 | """ |
|
933 | 936 | if p0 == 2: |
|
934 | 937 | self.volGraphPath.setEnabled(True) |
|
935 | 938 | self.volGraphPrefix.setEnabled(True) |
|
936 | 939 | self.volGraphToolPath.setEnabled(True) |
|
937 | 940 | |
|
938 | 941 | if p0 == 0: |
|
939 | 942 | self.volGraphPath.setEnabled(False) |
|
940 | 943 | self.volGraphPrefix.setEnabled(False) |
|
941 | 944 | self.volGraphToolPath.setEnabled(False) |
|
942 | 945 | |
|
943 | 946 | @pyqtSignature("") |
|
944 | 947 | def on_volGraphToolPath_clicked(self): |
|
945 | 948 | """ |
|
946 | 949 | Donde se guardan los DATOS |
|
947 | 950 | """ |
|
948 | 951 | self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
949 | 952 | self.volGraphPath.setText(self.dataPath) |
|
950 | 953 | |
|
951 | 954 | # if not os.path.exists(self.dataPath): |
|
952 | 955 | # self.volGraphOk.setEnabled(False) |
|
953 | 956 | # return |
|
954 | 957 | |
|
955 | 958 | @pyqtSignature("int") |
|
956 | 959 | def on_volGraphCebshow_stateChanged(self, p0): |
|
957 | 960 | """ |
|
958 | 961 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
959 | 962 | """ |
|
960 | 963 | if p0 == 0: |
|
961 | 964 | |
|
962 | 965 | self.volGraphChannelList.setEnabled(False) |
|
963 | 966 | self.volGraphfreqrange.setEnabled(False) |
|
964 | 967 | self.volGraphHeightrange.setEnabled(False) |
|
965 | 968 | if p0 == 2: |
|
966 | 969 | |
|
967 | 970 | self.volGraphChannelList.setEnabled(True) |
|
968 | 971 | self.volGraphfreqrange.setEnabled(True) |
|
969 | 972 | self.volGraphHeightrange.setEnabled(True) |
|
970 | 973 | |
|
971 | 974 | """ |
|
972 | 975 | Spectra operation |
|
973 | 976 | """ |
|
974 | 977 | @pyqtSignature("int") |
|
975 | 978 | def on_specOpCebRadarfrequency_stateChanged(self, p0): |
|
976 | 979 | """ |
|
977 | 980 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
978 | 981 | """ |
|
979 | 982 | if p0 == 2: |
|
980 | 983 | self.specOpRadarfrequency.setEnabled(True) |
|
981 | 984 | if p0 == 0: |
|
982 | 985 | self.specOpRadarfrequency.clear() |
|
983 | 986 | self.specOpRadarfrequency.setEnabled(False) |
|
984 | 987 | |
|
985 | 988 | |
|
986 | 989 | @pyqtSignature("int") |
|
987 | 990 | def on_specOpCebCrossSpectra_stateChanged(self, p0): |
|
988 | 991 | """ |
|
989 | 992 | Habilita la opcion de aοΏ½adir el parοΏ½metro CrossSpectra a la Unidad de Procesamiento . |
|
990 | 993 | """ |
|
991 | 994 | if p0 == 2: |
|
992 | 995 | # self.specOpnFFTpoints.setEnabled(True) |
|
993 | 996 | self.specOppairsList.setEnabled(True) |
|
994 | 997 | if p0 == 0: |
|
995 | 998 | # self.specOpnFFTpoints.setEnabled(False) |
|
996 | 999 | self.specOppairsList.setEnabled(False) |
|
997 | 1000 | |
|
998 | 1001 | @pyqtSignature("int") |
|
999 | 1002 | def on_specOpCebChannel_stateChanged(self, p0): |
|
1000 | 1003 | """ |
|
1001 | 1004 | Habilita la opcion de aοΏ½adir el parοΏ½metro numero de Canales a la Unidad de Procesamiento . |
|
1002 | 1005 | """ |
|
1003 | 1006 | if p0 == 2: |
|
1004 | 1007 | self.specOpChannel.setEnabled(True) |
|
1005 | 1008 | self.specOpComChannel.setEnabled(True) |
|
1006 | 1009 | if p0 == 0: |
|
1007 | 1010 | self.specOpChannel.setEnabled(False) |
|
1008 | 1011 | self.specOpComChannel.setEnabled(False) |
|
1009 | 1012 | |
|
1010 | 1013 | @pyqtSignature("int") |
|
1011 | 1014 | def on_specOpCebHeights_stateChanged(self, p0): |
|
1012 | 1015 | """ |
|
1013 | 1016 | Habilita la opcion de aοΏ½adir el parοΏ½metro de alturas a la Unidad de Procesamiento . |
|
1014 | 1017 | """ |
|
1015 | 1018 | if p0 == 2: |
|
1016 | 1019 | self.specOpComHeights.setEnabled(True) |
|
1017 | 1020 | self.specOpHeights.setEnabled(True) |
|
1018 | 1021 | if p0 == 0: |
|
1019 | 1022 | self.specOpComHeights.setEnabled(False) |
|
1020 | 1023 | self.specOpHeights.setEnabled(False) |
|
1021 | 1024 | |
|
1022 | 1025 | |
|
1023 | 1026 | @pyqtSignature("int") |
|
1024 | 1027 | def on_specOpCebIncoherent_stateChanged(self, p0): |
|
1025 | 1028 | """ |
|
1026 | 1029 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
1027 | 1030 | """ |
|
1028 | 1031 | if p0 == 2: |
|
1029 | 1032 | self.specOpIncoherent.setEnabled(True) |
|
1030 | 1033 | if p0 == 0: |
|
1031 | 1034 | self.specOpIncoherent.setEnabled(False) |
|
1032 | 1035 | |
|
1033 | 1036 | @pyqtSignature("int") |
|
1034 | 1037 | def on_specOpCebRemoveDC_stateChanged(self, p0): |
|
1035 | 1038 | """ |
|
1036 | 1039 | Habilita la opcion de aοΏ½adir el parοΏ½metro remover DC a la Unidad de Procesamiento . |
|
1037 | 1040 | """ |
|
1038 | 1041 | if p0 == 2: |
|
1039 | 1042 | self.specOpComRemoveDC.setEnabled(True) |
|
1040 | 1043 | if p0 == 0: |
|
1041 | 1044 | self.specOpComRemoveDC.setEnabled(False) |
|
1042 | 1045 | |
|
1043 | 1046 | @pyqtSignature("int") |
|
1044 | 1047 | def on_specOpCebgetNoise_stateChanged(self, p0): |
|
1045 | 1048 | """ |
|
1046 | 1049 | Habilita la opcion de aοΏ½adir la estimacion de ruido a la Unidad de Procesamiento . |
|
1047 | 1050 | """ |
|
1048 | 1051 | if p0 == 2: |
|
1049 | 1052 | self.specOpgetNoise.setEnabled(True) |
|
1050 | 1053 | |
|
1051 | 1054 | if p0 == 0: |
|
1052 | 1055 | self.specOpgetNoise.setEnabled(False) |
|
1053 | ||
|
1054 | ||
|
1055 | def refreshID(self, puObj): | |
|
1056 | opObj = puObj.getOperationObj(name='Scope') | |
|
1057 | # opObj = puObj.getOpObjfromParamValue(value="Scope") | |
|
1058 | if opObj == None: | |
|
1059 | pass | |
|
1060 | else: | |
|
1061 | name_parameter1 = 'id' | |
|
1062 | format1 = 'int' | |
|
1063 | if self.idImagscope == 0: | |
|
1064 | self.idImagscope = 100 | |
|
1065 | else: | |
|
1066 | self.idImagscope = self.idImagscope + 1 | |
|
1067 | value1 = int(self.idImagscope) | |
|
1068 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1069 | ||
|
1070 | opObj = puObj.getOperationObj(name='SpectraPlot') | |
|
1071 | # opObj = puObj.getOpObjfromParamValue(value="SpectraPlot") | |
|
1072 | if opObj == None: | |
|
1073 | pass | |
|
1074 | else: | |
|
1075 | name_parameter1 = 'id' | |
|
1076 | format1 = 'int' | |
|
1077 | if self.idImagspectra == 0: | |
|
1078 | self.idImagspectra = 200 | |
|
1079 | else: | |
|
1080 | self.idImagspectra = self.idImagspectra + 1 | |
|
1081 | value1 = int(self.idImagspectra) | |
|
1082 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1083 | ||
|
1084 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') | |
|
1085 | # opObj = puObj.getOpObjfromParamValue(value="CrossSpectraPlot") | |
|
1086 | if opObj == None: | |
|
1087 | pass | |
|
1088 | else: | |
|
1089 | name_parameter1 = 'id' | |
|
1090 | format1 = 'int' | |
|
1091 | if self.idImagcross == 0: | |
|
1092 | self.idImagcross = 300 | |
|
1093 | else: | |
|
1094 | self.idImagcross = self.idImagcross + 1 | |
|
1095 | value1 = int(self.idImagcross) | |
|
1096 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1097 | ||
|
1098 | opObj = puObj.getOperationObj(name='RTIPlot') | |
|
1099 | # opObj = puObj.getOpObjfromParamValue(value="RTIPlot") | |
|
1100 | if opObj == None: | |
|
1101 | pass | |
|
1102 | else: | |
|
1103 | name_parameter1 = 'id' | |
|
1104 | format1 = 'int' | |
|
1105 | if self.idImagrti == 0: | |
|
1106 | self.idImagrti = 400 | |
|
1107 | else: | |
|
1108 | self.idImagrti = self.idImagrti + 1 | |
|
1109 | value1 = int(self.idImagrti) | |
|
1110 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1111 | ||
|
1112 | opObj = puObj.getOperationObj(name='CoherenceMap') | |
|
1113 | # opObj = puObj.getOpObjfromParamValue(value="CoherenceMap") | |
|
1114 | if opObj == None: | |
|
1115 | pass | |
|
1116 | else: | |
|
1117 | name_parameter1 = 'id' | |
|
1118 | format1 = 'int' | |
|
1119 | if self.idImagcoherence == 0: | |
|
1120 | self.idImagcoherence = 500 | |
|
1121 | else: | |
|
1122 | self.idImagcoherence = self.idImagcoherence + 1 | |
|
1123 | value1 = int(self.idImagcoherence) | |
|
1124 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1125 | ||
|
1126 | opObj = puObj.getOperationObj(name='PowerProfilePlot') | |
|
1127 | # opObj = puObj.getOpObjfromParamValue(value="PowerProfilePlot") | |
|
1128 | if opObj == None: | |
|
1129 | pass | |
|
1130 | else: | |
|
1131 | name_parameter1 = 'id' | |
|
1132 | format1 = 'int' | |
|
1133 | if self.idImagpower == 0: | |
|
1134 | self.idImagpower = 600 | |
|
1135 | else: | |
|
1136 | self.idImagpower = self.idImagpower + 1 | |
|
1137 | value1 = int(self.idImagpower) | |
|
1138 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1139 | ||
|
1140 | opObj = puObj.getOperationObj(name='Noise') | |
|
1141 | # opObj = puObj.getOpObjfromParamValue(value="Noise") | |
|
1142 | if opObj == None: | |
|
1143 | pass | |
|
1144 | else: | |
|
1145 | name_parameter1 = 'id' | |
|
1146 | format1 = 'int' | |
|
1147 | if self.idImagrtinoise == 0: | |
|
1148 | self.idImagrtinoise = 700 | |
|
1149 | else: | |
|
1150 | self.idImagrtinoise = self.idImagrtinoise + 1 | |
|
1151 | value1 = int(self.idImagrtinoise) | |
|
1152 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1153 | ||
|
1154 | opObj = puObj.getOperationObj(name='SpectraHeisScope') | |
|
1155 | # opObj = puObj.getOpObjfromParamValue(value="SpectraHeisScope") | |
|
1156 | if opObj == None: | |
|
1157 | pass | |
|
1158 | else: | |
|
1159 | name_parameter1 = 'id' | |
|
1160 | format1 = 'int' | |
|
1161 | if self.idImagspectraHeis == 0: | |
|
1162 | self.idImagspectraHeis = 800 | |
|
1163 | else: | |
|
1164 | self.idImagspectraHeis = self.idImagspectraHeis + 1 | |
|
1165 | value1 = int(self.idImagspectraHeis) | |
|
1166 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1167 | ||
|
1168 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') | |
|
1169 | # opObj = puObj.getOpObjfromParamValue(value="RTIfromSpectraHeis") | |
|
1170 | if opObj == None: | |
|
1171 | pass | |
|
1172 | else: | |
|
1173 | name_parameter1 = 'id' | |
|
1174 | format1 = 'int' | |
|
1175 | if self.idImagrtiHeis == 0: | |
|
1176 | self.idImagrtiHeis = 900 | |
|
1177 | else: | |
|
1178 | self.idImagrtiHeis = self.idImagrtiHeis + 1 | |
|
1179 | value1 = int(self.idImagrtiHeis) | |
|
1180 | opObj.changeParameter(name=name_parameter1, value=value1, format=format1) | |
|
1181 | 1056 | |
|
1182 | 1057 | @pyqtSignature("") |
|
1183 | 1058 | def on_specOpOk_clicked(self): |
|
1184 | 1059 | """ |
|
1185 | 1060 | AΓADE OPERACION SPECTRA |
|
1186 | 1061 | """ |
|
1187 | 1062 | |
|
1188 | 1063 | addFTP = False |
|
1189 | 1064 | checkPath = False |
|
1190 | 1065 | |
|
1191 | 1066 | self.actionSaveToolbar.setEnabled(False) |
|
1192 | 1067 | self.actionStarToolbar.setEnabled(False) |
|
1193 | 1068 | |
|
1194 | 1069 | projectObj = self.getSelectedProjectObj() |
|
1195 | 1070 | puObj = self.getSelectedItemObj() |
|
1196 | 1071 | |
|
1197 | 1072 | puObj.removeOperations() |
|
1198 | 1073 | |
|
1199 | 1074 | if self.specOpCebRadarfrequency.isChecked(): |
|
1200 | 1075 | value = self.specOpRadarfrequency.text() |
|
1201 | 1076 | format = 'float' |
|
1202 | 1077 | name_operation = 'setRadarFrequency' |
|
1203 | 1078 | name_parameter = 'frequency' |
|
1204 | 1079 | if not value == "": |
|
1205 | 1080 | try: |
|
1206 | 1081 | radarfreq = float(self.specOpRadarfrequency.text()) |
|
1207 | 1082 | except: |
|
1208 | 1083 | self.console.clear() |
|
1209 | 1084 | self.console.append("Write the parameter Radar Frequency type float") |
|
1210 | 1085 | return 0 |
|
1211 | 1086 | opObj = puObj.addOperation(name=name_operation) |
|
1212 | 1087 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
1213 | 1088 | |
|
1214 | 1089 | inputId = puObj.getInputId() |
|
1215 | 1090 | inputPuObj = projectObj.getProcUnitObj(inputId) |
|
1216 | 1091 | |
|
1217 | 1092 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': |
|
1218 | 1093 | |
|
1219 | 1094 | try: |
|
1220 | 1095 | value = int(self.specOpnFFTpoints.text()) |
|
1221 | 1096 | puObj.addParameter(name='nFFTPoints', value=value, format='int') |
|
1222 | 1097 | except: |
|
1223 | 1098 | self.console.clear() |
|
1224 | 1099 | self.console.append("Please write the number of FFT") |
|
1225 | 1100 | return 0 |
|
1226 | 1101 | |
|
1227 | 1102 | try: |
|
1228 | 1103 | value1 = int(self.specOpProfiles.text()) |
|
1229 | 1104 | puObj.addParameter(name='nProfiles', value=value1, format='int') |
|
1230 | 1105 | except: |
|
1231 | 1106 | self.console.append("Please Write the number of Profiles") |
|
1232 | 1107 | |
|
1233 | 1108 | try: |
|
1234 | 1109 | value2 = int(self.specOpippFactor.text()) |
|
1235 | 1110 | puObj.addParameter(name='ippFactor' , value=value2 , format='int') |
|
1236 | 1111 | except: |
|
1237 | 1112 | self.console.append("Please Write the Number of IppFactor") |
|
1238 | 1113 | |
|
1239 | 1114 | |
|
1240 | 1115 | if self.specOpCebCrossSpectra.isChecked(): |
|
1241 | 1116 | name_parameter = 'pairsList' |
|
1242 | 1117 | format = 'pairslist' |
|
1243 | 1118 | value2 = self.specOppairsList.text() |
|
1244 | 1119 | |
|
1245 | 1120 | if value2 == "": |
|
1246 | 1121 | print "Please fill the pairs list field" |
|
1247 | 1122 | return 0 |
|
1248 | 1123 | |
|
1249 | 1124 | puObj.addParameter(name=name_parameter, value=value2, format=format) |
|
1250 | 1125 | |
|
1251 | 1126 | if self.specOpCebHeights.isChecked(): |
|
1252 | 1127 | value = str(self.specOpHeights.text()) |
|
1253 | 1128 | |
|
1254 | 1129 | if value == "": |
|
1255 | 1130 | print "Please fill height range" |
|
1256 | 1131 | return 0 |
|
1257 | 1132 | |
|
1258 | 1133 | valueList = value.split(',') |
|
1259 | 1134 | format = 'float' |
|
1260 | 1135 | value0 = valueList[0] |
|
1261 | 1136 | value1 = valueList[1] |
|
1262 | 1137 | |
|
1263 | 1138 | if self.specOpComHeights.currentIndex() == 0: |
|
1264 | 1139 | name_operation = 'selectHeights' |
|
1265 | 1140 | name_parameter1 = 'minHei' |
|
1266 | 1141 | name_parameter2 = 'maxHei' |
|
1267 | 1142 | else: |
|
1268 | 1143 | name_operation = 'selectHeightsByIndex' |
|
1269 | 1144 | name_parameter1 = 'minIndex' |
|
1270 | 1145 | name_parameter2 = 'maxIndex' |
|
1271 | 1146 | opObj = puObj.addOperation(name=name_operation) |
|
1272 | 1147 | opObj.addParameter(name=name_parameter1, value=value0, format=format) |
|
1273 | 1148 | opObj.addParameter(name=name_parameter2, value=value1, format=format) |
|
1274 | 1149 | |
|
1275 | 1150 | if self.specOpCebChannel.isChecked(): |
|
1276 | 1151 | value = str(self.specOpChannel.text()) |
|
1277 | 1152 | |
|
1278 | 1153 | if value == "": |
|
1279 | 1154 | print "Please fill channel list" |
|
1280 | 1155 | return 0 |
|
1281 | 1156 | |
|
1282 | 1157 | format = 'intlist' |
|
1283 | 1158 | if self.specOpComChannel.currentIndex() == 0: |
|
1284 | 1159 | name_operation = "selectChannels" |
|
1285 | 1160 | name_parameter = 'channelList' |
|
1286 | 1161 | else: |
|
1287 | 1162 | name_operation = "selectChannelsByIndex" |
|
1288 | 1163 | name_parameter = 'channelIndexList' |
|
1164 | ||
|
1289 | 1165 | opObj = puObj.addOperation(name=name_operation) |
|
1290 | 1166 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1291 | 1167 | |
|
1292 | 1168 | if self.specOpCebIncoherent.isChecked(): |
|
1293 | 1169 | value = str(self.specOpIncoherent.text()) |
|
1294 | 1170 | |
|
1295 | 1171 | if value == "": |
|
1296 | 1172 | print "Please fill Incoherent integration value" |
|
1297 | 1173 | return 0 |
|
1298 | 1174 | |
|
1299 | 1175 | name_operation = 'IncohInt' |
|
1300 | 1176 | optype = 'other' |
|
1301 | 1177 | if self.specOpCobIncInt.currentIndex() == 0: |
|
1302 | 1178 | name_parameter = 'timeInterval' |
|
1303 | 1179 | format = 'float' |
|
1304 | 1180 | else: |
|
1305 | 1181 | name_parameter = 'n' |
|
1306 | 1182 | format = 'float' |
|
1307 | 1183 | |
|
1308 | 1184 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1309 | 1185 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1310 | 1186 | |
|
1311 | 1187 | if self.specOpCebRemoveDC.isChecked(): |
|
1312 | 1188 | name_operation = 'removeDC' |
|
1313 | 1189 | name_parameter = 'mode' |
|
1314 | 1190 | format = 'int' |
|
1315 | 1191 | if self.specOpComRemoveDC.currentIndex() == 0: |
|
1316 | 1192 | value = 1 |
|
1317 | 1193 | else: |
|
1318 | 1194 | value = 2 |
|
1319 | 1195 | opObj = puObj.addOperation(name=name_operation) |
|
1320 | 1196 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1321 | 1197 | |
|
1322 | 1198 | if self.specOpCebRemoveInt.isChecked(): |
|
1323 | 1199 | name_operation = 'removeInterference' |
|
1324 | 1200 | opObj = puObj.addOperation(name=name_operation) |
|
1325 | 1201 | |
|
1326 | 1202 | |
|
1327 | 1203 | if self.specOpCebgetNoise.isChecked(): |
|
1328 | 1204 | value = self.specOpgetNoise.text() |
|
1329 | 1205 | valueList = value.split(',') |
|
1330 | 1206 | format = 'float' |
|
1331 | 1207 | name_operation = "getNoise" |
|
1332 | 1208 | opObj = puObj.addOperation(name=name_operation) |
|
1333 | 1209 | |
|
1334 | 1210 | if not value == '': |
|
1335 | 1211 | valueList = value.split(',') |
|
1336 | 1212 | length = len(valueList) |
|
1337 | 1213 | if length == 1: |
|
1338 | 1214 | try: |
|
1339 | 1215 | value1 = float(valueList[0]) |
|
1340 | 1216 | except: |
|
1341 | 1217 | self.console.clear() |
|
1342 | 1218 | self.console.append("Please Write correct parameter Get Noise") |
|
1343 | 1219 | return 0 |
|
1344 | 1220 | name1 = 'minHei' |
|
1345 | 1221 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1346 | 1222 | elif length == 2: |
|
1347 | 1223 | try: |
|
1348 | 1224 | value1 = float(valueList[0]) |
|
1349 | 1225 | value2 = float(valueList[1]) |
|
1350 | 1226 | except: |
|
1351 | 1227 | self.console.clear() |
|
1352 | 1228 | self.console.append("Please Write corrects parameter Get Noise") |
|
1353 | 1229 | return 0 |
|
1354 | 1230 | name1 = 'minHei' |
|
1355 | 1231 | name2 = 'maxHei' |
|
1356 | 1232 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1357 | 1233 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1358 | 1234 | |
|
1359 | 1235 | elif length == 3: |
|
1360 | 1236 | try: |
|
1361 | 1237 | value1 = float(valueList[0]) |
|
1362 | 1238 | value2 = float(valueList[1]) |
|
1363 | 1239 | value3 = float(valueList[2]) |
|
1364 | 1240 | except: |
|
1365 | 1241 | self.console.clear() |
|
1366 | 1242 | self.console.append("Please Write corrects parameter Get Noise") |
|
1367 | 1243 | return 0 |
|
1368 | 1244 | name1 = 'minHei' |
|
1369 | 1245 | name2 = 'maxHei' |
|
1370 | 1246 | name3 = 'minVel' |
|
1371 | 1247 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1372 | 1248 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1373 | 1249 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1374 | 1250 | |
|
1375 | 1251 | elif length == 4: |
|
1376 | 1252 | try: |
|
1377 | 1253 | value1 = float(valueList[0]) |
|
1378 | 1254 | value2 = float(valueList[1]) |
|
1379 | 1255 | value3 = float(valueList[2]) |
|
1380 | 1256 | value4 = float(valueList[3]) |
|
1381 | 1257 | except: |
|
1382 | 1258 | self.console.clear() |
|
1383 | 1259 | self.console.append("Please Write corrects parameter Get Noise") |
|
1384 | 1260 | return 0 |
|
1385 | 1261 | name1 = 'minHei' |
|
1386 | 1262 | name2 = 'maxHei' |
|
1387 | 1263 | name3 = 'minVel' |
|
1388 | 1264 | name4 = 'maxVel' |
|
1389 | 1265 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1390 | 1266 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1391 | 1267 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1392 | 1268 | opObj.addParameter(name=name4, value=value4, format=format) |
|
1393 | 1269 | |
|
1394 | 1270 | elif length > 4: |
|
1395 | 1271 | self.console.clear() |
|
1396 | 1272 | self.console.append("Get Noise Operation only accepts 4 parameters") |
|
1397 | 1273 | return 0 |
|
1398 | ||
|
1274 | ||
|
1275 | channelList = str(self.specGgraphChannelList.text()).replace(" ","") | |
|
1276 | vel_range = str(self.specGgraphFreq.text()).replace(" ","") | |
|
1277 | hei_range = str(self.specGgraphHeight.text()).replace(" ","") | |
|
1278 | db_range = str(self.specGgraphDbsrange.text()).replace(" ","") | |
|
1279 | ||
|
1280 | trange = str(self.specGgraphTminTmax.text()).replace(" ","") | |
|
1281 | magrange = str(self.specGgraphmagnitud.text()).replace(" ","") | |
|
1282 | phaserange = str(self.specGgraphPhase.text()).replace(" ","") | |
|
1283 | # timerange = str(self.specGgraphTimeRange.text()).replace(" ","") | |
|
1284 | ||
|
1285 | figpath = str(self.specGraphPath.text()) | |
|
1286 | figfile = str(self.specGraphPrefix.text()).replace(" ","") | |
|
1287 | try: | |
|
1288 | wrperiod = int(str(self.specGgraphftpratio.text()).replace(" ","")) | |
|
1289 | except: | |
|
1290 | wrperiod = None | |
|
1291 | ||
|
1399 | 1292 | #-----Spectra Plot----- |
|
1400 |
if self.specGraphCebSpectraplot.isChecked(): |
|
|
1401 | name_operation = 'SpectraPlot' | |
|
1402 | optype = 'other' | |
|
1403 | name_parameter = 'type' | |
|
1404 | value = 'SpectraPlot' | |
|
1405 | format = 'str' | |
|
1406 | if self.idImagspectra == 0: | |
|
1407 | self.idImagspectra = 200 | |
|
1408 | else: | |
|
1409 | self.idImagspectra = self.idImagspectra + 1 | |
|
1410 | name_parameter1 = 'id' | |
|
1411 | value1 = int(self.idImagspectra) | |
|
1412 | format1 = 'int' | |
|
1413 | ||
|
1414 | format = 'str' | |
|
1415 | ||
|
1416 | channelList = self.specGgraphChannelList.text() | |
|
1417 | xvalue = self.specGgraphFreq.text() | |
|
1418 | yvalue = self.specGgraphHeight.text() | |
|
1419 | zvalue = self.specGgraphDbsrange.text() | |
|
1420 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
|
1421 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
|
1422 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) | |
|
1293 | if self.specGraphCebSpectraplot.isChecked(): | |
|
1294 | ||
|
1295 | opObj = puObj.addOperation(name='SpectraPlot', optype='other') | |
|
1296 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
|
1423 | 1297 | |
|
1424 | 1298 | if not channelList == '': |
|
1425 | name_parameter = 'channelList' | |
|
1426 | format = 'intlist' | |
|
1427 | opObj.addParameter(name=name_parameter, value=channelList, format=format) | |
|
1299 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
|
1428 | 1300 | |
|
1429 |
if not |
|
|
1430 |
xvalueList = |
|
|
1301 | if not vel_range == '': | |
|
1302 | xvalueList = vel_range.split(',') | |
|
1431 | 1303 | try: |
|
1432 | 1304 | value1 = float(xvalueList[0]) |
|
1433 | 1305 | value2 = float(xvalueList[1]) |
|
1434 | 1306 | except: |
|
1435 |
|
|
|
1436 |
|
|
|
1437 |
|
|
|
1438 |
|
|
|
1439 | name2 = 'xmax' | |
|
1440 | format = 'float' | |
|
1441 | opObj.addParameter(name=name1, value=value1, format=format) | |
|
1442 | opObj.addParameter(name=name2, value=value2, format=format) | |
|
1443 | #------specGgraphHeight--- | |
|
1444 |
|
|
|
1445 |
|
|
|
1446 | try: | |
|
1447 | value1 = float(yvalueList[0]) | |
|
1448 | value2 = float(yvalueList[1]) | |
|
1449 | except: | |
|
1450 | self.console.clear() | |
|
1451 | self.console.append("Please Write corrects parameter Height") | |
|
1452 | return 0 | |
|
1453 | name1 = 'ymin' | |
|
1454 | name2 = 'ymax' | |
|
1455 | format = 'float' | |
|
1456 | opObj.addParameter(name=name1, value=value1, format=format) | |
|
1457 | opObj.addParameter(name=name2, value=value2, format=format) | |
|
1307 | self.console.clear() | |
|
1308 | self.console.append("Invalid velocity/frequency range") | |
|
1309 | return 0 | |
|
1310 | ||
|
1311 | opObj.addParameter(name='xmin', value=value1, format='float') | |
|
1312 | opObj.addParameter(name='xmax', value=value2, format='float') | |
|
1313 | ||
|
1314 | if not hei_range == '': | |
|
1315 | yvalueList = hei_range.split(",") | |
|
1316 | try: | |
|
1317 | value1 = float(yvalueList[0]) | |
|
1318 | value2 = float(yvalueList[1]) | |
|
1319 | except: | |
|
1320 | self.console.clear() | |
|
1321 | self.console.append("Invalid height range") | |
|
1322 | return 0 | |
|
1323 | ||
|
1324 | opObj.addParameter(name='ymin', value=value1, format='float') | |
|
1325 | opObj.addParameter(name='ymax', value=value2, format='float') | |
|
1458 | 1326 | |
|
1459 |
if not |
|
|
1460 |
zvalueList = |
|
|
1327 | if not db_range == '': | |
|
1328 | zvalueList = db_range.split(",") | |
|
1461 | 1329 | try: |
|
1462 |
|
|
|
1463 |
|
|
|
1330 | value1 = float(zvalueList[0]) | |
|
1331 | value2 = float(zvalueList[1]) | |
|
1464 | 1332 | except: |
|
1465 |
|
|
|
1466 |
|
|
|
1467 |
|
|
|
1468 |
|
|
|
1469 |
opObj.addParameter(name='zmin', value= |
|
|
1470 |
opObj.addParameter(name='zmax', value= |
|
|
1333 | self.console.clear() | |
|
1334 | self.console.append("Invalid db range") | |
|
1335 | return 0 | |
|
1336 | ||
|
1337 | opObj.addParameter(name='zmin', value=value1, format='float') | |
|
1338 | opObj.addParameter(name='zmax', value=value2, format='float') | |
|
1471 | 1339 | |
|
1472 | 1340 | if self.specGraphSaveSpectra.isChecked(): |
|
1473 | 1341 | checkPath = True |
|
1474 | name_parameter1 = 'save' | |
|
1475 | name_parameter2 = 'figpath' | |
|
1476 |
|
|
|
1477 | value1 = '1' | |
|
1478 | value2 = self.specGraphPath.text() | |
|
1479 | value3 = self.specGraphPrefix.text() | |
|
1480 | format1 = 'bool' | |
|
1481 | format2 = 'str' | |
|
1482 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) | |
|
1483 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) | |
|
1484 | opObj.addParameter(name=name_parameter3, value=value3, format=format2) | |
|
1485 | ||
|
1486 | # opObj.addParameter(name='wr_period', value='5',format='int') | |
|
1342 | opObj.addParameter(name='save', value=1 , format='bool') | |
|
1343 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
|
1344 | if figfile: | |
|
1345 | opObj.addParameter(name='figfile', value=figfile, format='str') | |
|
1346 | if wrperiod: | |
|
1347 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
|
1487 | 1348 | |
|
1488 | 1349 | if self.specGraphftpSpectra.isChecked(): |
|
1489 | 1350 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1490 | 1351 | self.addFTPConf2Operation(puObj, opObj) |
|
1491 | 1352 | addFTP = True |
|
1492 | 1353 | |
|
1493 | 1354 | if self.specGraphCebCrossSpectraplot.isChecked(): |
|
1494 | name_operation = 'CrossSpectraPlot' | |
|
1495 | optype = 'other' | |
|
1496 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
|
1497 |
# opObj.addParameter(name=' |
|
|
1498 |
opObj.addParameter(name='p |
|
|
1499 | opObj.addParameter(name='coherence_cmap', value='jet', format='str') | |
|
1500 | opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') | |
|
1501 | ||
|
1502 | if self.idImagcross == 0: | |
|
1503 | self.idImagcross = 300 | |
|
1504 | else: | |
|
1505 | self.idImagcross = self.idImagcross + 1 | |
|
1506 | value1 = int(self.idImagcross) | |
|
1507 | channelList = self.specGgraphChannelList.text() | |
|
1508 | xvalue = self.specGgraphFreq.text() | |
|
1509 | yvalue = self.specGgraphHeight.text() | |
|
1510 | zvalue = self.specGgraphDbsrange.text() | |
|
1511 | ||
|
1355 | ||
|
1356 | opObj = puObj.addOperation(name='CrossSpectraPlot', optype='other') | |
|
1357 | # opObj.addParameter(name='power_cmap', value='jet', format='str') | |
|
1358 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') | |
|
1359 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') | |
|
1512 | 1360 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1513 | ||
|
1514 | if self.specGgraphChannelList.isModified(): | |
|
1515 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
|
1361 | ||
|
1362 | if not vel_range == '': | |
|
1363 | xvalueList = vel_range.split(',') | |
|
1364 | try: | |
|
1365 | value1 = float(xvalueList[0]) | |
|
1366 | value2 = float(xvalueList[1]) | |
|
1367 | except: | |
|
1368 | self.console.clear() | |
|
1369 | self.console.append("Invalid velocity/frequency range") | |
|
1370 | return 0 | |
|
1371 | ||
|
1372 | opObj.addParameter(name='xmin', value=value1, format='float') | |
|
1373 | opObj.addParameter(name='xmax', value=value2, format='float') | |
|
1516 | 1374 | |
|
1517 |
if not |
|
|
1518 |
|
|
|
1519 | try: | |
|
1520 |
value = float( |
|
|
1521 |
value = float( |
|
|
1522 | except: | |
|
1523 |
|
|
|
1524 | format = 'float' | |
|
1525 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) | |
|
1526 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) | |
|
1527 | ||
|
1528 | if not yvalue == '': | |
|
1529 | yvalueList = yvalue.split(",") | |
|
1530 | try: | |
|
1531 | value = float(yvalueList[0]) | |
|
1532 | value = float(yvalueList[1]) | |
|
1533 | except: | |
|
1534 | return 0 | |
|
1535 | format = 'float' | |
|
1536 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) | |
|
1537 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) | |
|
1538 | ||
|
1375 | if not hei_range == '': | |
|
1376 | yvalueList = hei_range.split(",") | |
|
1377 | try: | |
|
1378 | value1 = float(yvalueList[0]) | |
|
1379 | value2 = float(yvalueList[1]) | |
|
1380 | except: | |
|
1381 | self.console.clear() | |
|
1382 | self.console.append("Invalid height range") | |
|
1383 | return 0 | |
|
1384 | ||
|
1385 | opObj.addParameter(name='ymin', value=value1, format='float') | |
|
1386 | opObj.addParameter(name='ymax', value=value2, format='float') | |
|
1539 | 1387 | |
|
1540 |
if not |
|
|
1541 |
|
|
|
1542 |
|
|
|
1543 |
|
|
|
1544 |
|
|
|
1545 |
|
|
|
1546 | return 0 | |
|
1547 | opObj.addParameter(name='zmin', value=zvalueList[0], format='float') | |
|
1548 | opObj.addParameter(name='zmax', value=zvalueList[1], format='float') | |
|
1549 | ||
|
1388 | if not db_range == '': | |
|
1389 | zvalueList = db_range.split(",") | |
|
1390 | try: | |
|
1391 | value1 = float(zvalueList[0]) | |
|
1392 | value2 = float(zvalueList[1]) | |
|
1393 | except: | |
|
1394 | self.console.clear() | |
|
1395 | self.console.append("Invalid db range") | |
|
1396 | return 0 | |
|
1397 | ||
|
1398 | opObj.addParameter(name='zmin', value=value1, format='float') | |
|
1399 | opObj.addParameter(name='zmax', value=value2, format='float') | |
|
1400 | ||
|
1401 | if not magrange == '': | |
|
1402 | zvalueList = magrange.split(",") | |
|
1403 | try: | |
|
1404 | value1 = float(zvalueList[0]) | |
|
1405 | value2 = float(zvalueList[1]) | |
|
1406 | except: | |
|
1407 | self.console.clear() | |
|
1408 | self.console.append("Invalid magnitude range") | |
|
1409 | return 0 | |
|
1410 | ||
|
1411 | opObj.addParameter(name='coh_min', value=value1, format='float') | |
|
1412 | opObj.addParameter(name='coh_max', value=value2, format='float') | |
|
1413 | ||
|
1414 | if not phaserange == '': | |
|
1415 | zvalueList = phaserange.split(",") | |
|
1416 | try: | |
|
1417 | value1 = float(zvalueList[0]) | |
|
1418 | value2 = float(zvalueList[1]) | |
|
1419 | except: | |
|
1420 | self.console.clear() | |
|
1421 | self.console.append("Invalid phase range") | |
|
1422 | return 0 | |
|
1423 | ||
|
1424 | opObj.addParameter(name='phase_min', value=value1, format='float') | |
|
1425 | opObj.addParameter(name='phase_max', value=value2, format='float') | |
|
1426 | ||
|
1550 | 1427 | if self.specGraphSaveCross.isChecked(): |
|
1551 | 1428 | checkPath = True |
|
1552 | 1429 | opObj.addParameter(name='save', value='1', format='bool') |
|
1553 |
opObj.addParameter(name='figpath', value= |
|
|
1554 | value = self.specGraphPrefix.text() | |
|
1555 | if not value == "": | |
|
1556 |
|
|
|
1557 | value = str(self.specGraphPrefix.text()) | |
|
1558 |
|
|
|
1559 | self.console.clear() | |
|
1560 | self.console.append("Please Write prefix") | |
|
1561 | return 0 | |
|
1562 | opObj.addParameter(name='figfile', value=value, format='str') | |
|
1563 | # opObj.addParameter(name='figfile', value=self.specGraphPrefix.text(), format='str') | |
|
1430 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
|
1431 | if figfile: | |
|
1432 | opObj.addParameter(name='figfile', value=figfile, format='str') | |
|
1433 | if wrperiod: | |
|
1434 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
|
1435 | ||
|
1564 | 1436 | if self.specGraphftpCross.isChecked(): |
|
1565 | 1437 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1566 | 1438 | self.addFTPConf2Operation(puObj, opObj) |
|
1567 | 1439 | addFTP = True |
|
1568 | 1440 | |
|
1569 | 1441 | if self.specGraphCebRTIplot.isChecked(): |
|
1570 | name_operation = 'RTIPlot' | |
|
1571 | optype = 'other' | |
|
1572 | name_parameter = 'type' | |
|
1573 | value = 'RTIPlot' | |
|
1574 | format = 'str' | |
|
1575 | ||
|
1576 | if self.idImagrti == 0: | |
|
1577 | self.idImagrti = 400 | |
|
1578 | else: | |
|
1579 | self.idImagrti = self.idImagrti + 1 | |
|
1580 | ||
|
1581 | name_parameter1 = 'id' | |
|
1582 | value1 = int(self.idImagrti) | |
|
1583 | format1 = 'int' | |
|
1584 | 1442 | |
|
1585 | format = 'str' | |
|
1586 | ||
|
1587 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
|
1588 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
|
1589 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) | |
|
1590 | ||
|
1591 | channelList = self.specGgraphChannelList.text() | |
|
1592 | xvalue = self.specGgraphTminTmax.text() | |
|
1593 | yvalue = self.specGgraphHeight.text() | |
|
1594 | zvalue = self.specGgraphDbsrange.text() | |
|
1595 | timerange = self.specGgraphTimeRange.text() | |
|
1443 | opObj = puObj.addOperation(name='RTIPlot', optype='other') | |
|
1444 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
|
1596 | 1445 | |
|
1597 | 1446 | if not channelList == '': |
|
1598 | 1447 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1599 | 1448 | |
|
1600 |
if not |
|
|
1601 |
xvalueList = |
|
|
1602 | try: | |
|
1603 | value = float(xvalueList[0]) | |
|
1604 | value = float(xvalueList[1]) | |
|
1605 | except: | |
|
1606 | return 0 | |
|
1607 | format = 'float' | |
|
1608 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) | |
|
1609 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) | |
|
1610 | ||
|
1611 | if not timerange == '': | |
|
1612 | format = 'int' | |
|
1449 | if not trange == '': | |
|
1450 | xvalueList = trange.split(',') | |
|
1613 | 1451 | try: |
|
1614 | timerange = int(timerange) | |
|
1452 | value1 = float(xvalueList[0]) | |
|
1453 | value2 = float(xvalueList[1]) | |
|
1615 | 1454 | except: |
|
1455 | self.console.clear() | |
|
1456 | self.console.append("Invalid time range") | |
|
1616 | 1457 | return 0 |
|
1617 | opObj.addParameter(name='timerange', value=timerange, format=format) | |
|
1618 | ||
|
1458 | ||
|
1459 | opObj.addParameter(name='xmin', value=value1, format='float') | |
|
1460 | opObj.addParameter(name='xmax', value=value2, format='float') | |
|
1461 | ||
|
1462 | # if not timerange == '': | |
|
1463 | # try: | |
|
1464 | # timerange = float(timerange) | |
|
1465 | # except: | |
|
1466 | # self.console.clear() | |
|
1467 | # self.console.append("Invalid time range") | |
|
1468 | # return 0 | |
|
1469 | # | |
|
1470 | # opObj.addParameter(name='timerange', value=timerange, format='float') | |
|
1619 | 1471 | |
|
1620 |
if not |
|
|
1621 |
yvalueList = |
|
|
1472 | if not hei_range == '': | |
|
1473 | yvalueList = hei_range.split(",") | |
|
1622 | 1474 | try: |
|
1623 | value = float(yvalueList[0]) | |
|
1624 | value = float(yvalueList[1]) | |
|
1475 | value1 = float(yvalueList[0]) | |
|
1476 | value2 = float(yvalueList[1]) | |
|
1625 | 1477 | except: |
|
1626 | return 0 | |
|
1627 | format = 'float' | |
|
1628 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) | |
|
1629 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) | |
|
1478 | self.console.clear() | |
|
1479 | self.console.append("Invalid height range") | |
|
1480 | return 0 | |
|
1481 | ||
|
1482 | opObj.addParameter(name='ymin', value=value1, format='float') | |
|
1483 | opObj.addParameter(name='ymax', value=value2, format='float') | |
|
1630 | 1484 | |
|
1631 |
if not |
|
|
1632 |
zvalueList = |
|
|
1485 | if not db_range == '': | |
|
1486 | zvalueList = db_range.split(",") | |
|
1633 | 1487 | try: |
|
1634 | value = float(zvalueList[0]) | |
|
1635 | value = float(zvalueList[1]) | |
|
1488 | value1 = float(zvalueList[0]) | |
|
1489 | value2 = float(zvalueList[1]) | |
|
1636 | 1490 | except: |
|
1637 |
|
|
|
1638 | format = 'float' | |
|
1639 | opObj.addParameter(name='zmin', value=zvalueList[0], format=format) | |
|
1640 | opObj.addParameter(name='zmax', value=zvalueList[1], format=format) | |
|
1491 | self.console.clear() | |
|
1492 | self.console.append("Invalid db range") | |
|
1493 | return 0 | |
|
1494 | ||
|
1495 | opObj.addParameter(name='zmin', value=value1, format='float') | |
|
1496 | opObj.addParameter(name='zmax', value=value2, format='float') | |
|
1641 | 1497 | |
|
1642 | 1498 | if self.specGraphSaveRTIplot.isChecked(): |
|
1643 | 1499 | checkPath = True |
|
1644 | 1500 | opObj.addParameter(name='save', value='1', format='bool') |
|
1645 |
opObj.addParameter(name='figpath', value= |
|
|
1646 | value = self.specGraphPrefix.text() | |
|
1647 | if not value == "": | |
|
1648 | try: | |
|
1649 | value = str(self.specGraphPrefix.text()) | |
|
1650 | except: | |
|
1651 | self.console.clear() | |
|
1652 | self.console.append("Please Write prefix") | |
|
1653 | return 0 | |
|
1501 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
|
1502 | if figfile: | |
|
1654 | 1503 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1655 | ||
|
1656 | # test_ftp | |
|
1504 | if wrperiod: | |
|
1505 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
|
1506 | ||
|
1657 | 1507 | if self.specGraphftpRTIplot.isChecked(): |
|
1658 | 1508 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1659 | 1509 | self.addFTPConf2Operation(puObj, opObj) |
|
1660 | 1510 | addFTP = True |
|
1661 | 1511 | |
|
1662 | 1512 | if self.specGraphCebCoherencmap.isChecked(): |
|
1663 | name_operation = 'CoherenceMap' | |
|
1664 | optype = 'other' | |
|
1665 | name_parameter = 'type' | |
|
1666 | value = 'CoherenceMap' | |
|
1667 | format = 'str' | |
|
1668 | if self.idImagcoherence == 0: | |
|
1669 | self.idImagcoherence = 500 | |
|
1670 | else: | |
|
1671 | self.idImagcoherence = self.idImagcoherence + 1 | |
|
1672 | ||
|
1673 | name_parameter1 = 'id' | |
|
1674 | value1 = int(self.idImagcoherence) | |
|
1675 | format1 = 'int' | |
|
1676 | 1513 | |
|
1677 |
opObj = puObj.addOperation(name= |
|
|
1514 | opObj = puObj.addOperation(name='CoherenceMap', optype='other') | |
|
1678 | 1515 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1679 | 1516 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1680 | 1517 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1681 |
opObj.addParameter(name= |
|
|
1682 | ||
|
1683 | channelList = self.specGgraphChannelList.text() | |
|
1684 | if not channelList == '': | |
|
1685 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
|
1518 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
|
1686 | 1519 | |
|
1687 | timerange = self.specGgraphTimeRange.text() | |
|
1688 |
|
|
|
1520 | # if not timerange == '': | |
|
1521 | # try: | |
|
1522 | # timerange = int(timerange) | |
|
1523 | # except: | |
|
1524 | # self.console.clear() | |
|
1525 | # self.console.append("Invalid time range") | |
|
1526 | # return 0 | |
|
1527 | # | |
|
1528 | # opObj.addParameter(name='timerange', value=timerange, format='int') | |
|
1529 | ||
|
1530 | if not trange == '': | |
|
1531 | xvalueList = trange.split(',') | |
|
1689 | 1532 | try: |
|
1690 | timerange = int(timerange) | |
|
1533 | value1 = float(xvalueList[0]) | |
|
1534 | value2 = float(xvalueList[1]) | |
|
1691 | 1535 | except: |
|
1536 | self.console.clear() | |
|
1537 | self.console.append("Invalid time range") | |
|
1692 | 1538 | return 0 |
|
1693 |
|
|
|
1694 |
opObj.addParameter(name=' |
|
|
1695 | ||
|
1696 | xvalue = self.specGgraphTminTmax.text() | |
|
1697 |
if not |
|
|
1698 |
|
|
|
1539 | ||
|
1540 | opObj.addParameter(name='xmin', value=value1, format='float') | |
|
1541 | opObj.addParameter(name='xmax', value=value2, format='float') | |
|
1542 | ||
|
1543 | if not hei_range == '': | |
|
1544 | yvalueList = hei_range.split(",") | |
|
1699 | 1545 | try: |
|
1700 |
value = float( |
|
|
1701 |
value = float( |
|
|
1546 | value1 = float(yvalueList[0]) | |
|
1547 | value2 = float(yvalueList[1]) | |
|
1702 | 1548 | except: |
|
1703 |
|
|
|
1704 | format = 'float' | |
|
1705 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) | |
|
1706 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) | |
|
1707 | ||
|
1708 | yvalue = self.specGgraphHeight.text() | |
|
1709 | if not yvalue == '': | |
|
1710 | yvalueList = yvalue.split(",") | |
|
1549 | self.console.clear() | |
|
1550 | self.console.append("Invalid height range") | |
|
1551 | return 0 | |
|
1552 | ||
|
1553 | opObj.addParameter(name='ymin', value=value1, format='float') | |
|
1554 | opObj.addParameter(name='ymax', value=value2, format='float') | |
|
1555 | ||
|
1556 | if not magrange == '': | |
|
1557 | zvalueList = magrange.split(",") | |
|
1711 | 1558 | try: |
|
1712 |
value = float( |
|
|
1713 |
value = float( |
|
|
1559 | value1 = float(zvalueList[0]) | |
|
1560 | value2 = float(zvalueList[1]) | |
|
1714 | 1561 | except: |
|
1715 |
|
|
|
1716 | format = 'float' | |
|
1717 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) | |
|
1718 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) | |
|
1719 | ||
|
1720 | zvalue = self.specGgraphmagnitud.text() | |
|
1721 | if not zvalue == '': | |
|
1722 | zvalueList = zvalue.split(",") | |
|
1562 | self.console.clear() | |
|
1563 | self.console.append("Invalid magnitude range") | |
|
1564 | return 0 | |
|
1565 | ||
|
1566 | opObj.addParameter(name='zmin', value=value1, format='float') | |
|
1567 | opObj.addParameter(name='zmax', value=value2, format='float') | |
|
1568 | ||
|
1569 | if not phaserange == '': | |
|
1570 | zvalueList = phaserange.split(",") | |
|
1723 | 1571 | try: |
|
1724 | value = float(zvalueList[0]) | |
|
1725 | value = float(zvalueList[1]) | |
|
1572 | value1 = float(zvalueList[0]) | |
|
1573 | value2 = float(zvalueList[1]) | |
|
1726 | 1574 | except: |
|
1727 |
|
|
|
1728 | opObj.addParameter(name='zmin', value=zvalueList[0], format='float') | |
|
1729 | opObj.addParameter(name='zmax', value=zvalueList[1], format='float') | |
|
1730 | ||
|
1575 | self.console.clear() | |
|
1576 | self.console.append("Invalid phase range") | |
|
1577 | return 0 | |
|
1578 | ||
|
1579 | opObj.addParameter(name='phase_min', value=value1, format='float') | |
|
1580 | opObj.addParameter(name='phase_max', value=value2, format='float') | |
|
1581 | ||
|
1731 | 1582 | if self.specGraphSaveCoherencemap.isChecked(): |
|
1732 | 1583 | checkPath = True |
|
1733 | 1584 | opObj.addParameter(name='save', value='1', format='bool') |
|
1734 |
opObj.addParameter(name='figpath', value= |
|
|
1735 | value = self.specGraphPrefix.text() | |
|
1736 | if not value == "": | |
|
1737 | try: | |
|
1738 | value = str(self.specGraphPrefix.text()) | |
|
1739 | except: | |
|
1740 | self.console.clear() | |
|
1741 | self.console.append("Please Write prefix") | |
|
1742 | return 0 | |
|
1585 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
|
1586 | if figfile: | |
|
1743 | 1587 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1744 | ||
|
1745 | # test_ftp | |
|
1588 | if wrperiod: | |
|
1589 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
|
1590 | ||
|
1746 | 1591 | if self.specGraphftpCoherencemap.isChecked(): |
|
1747 | 1592 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1748 | 1593 | self.addFTPConf2Operation(puObj, opObj) |
|
1749 | 1594 | addFTP = True |
|
1750 | 1595 | |
|
1751 | 1596 | if self.specGraphPowerprofile.isChecked(): |
|
1752 | name_operation = 'PowerProfilePlot' | |
|
1753 | optype = 'other' | |
|
1754 | name_parameter = 'type' | |
|
1755 | value = 'PowerProfilePlot' | |
|
1756 | format = 'str' | |
|
1757 | ||
|
1758 | if self.idImagpower == 0: | |
|
1759 | self.idImagpower = 600 | |
|
1760 | else: | |
|
1761 | self.idImagpower = self.idImagpower + 1 | |
|
1762 | value1 = int(self.idImagpower) | |
|
1763 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
|
1764 | # opObj.addParameter(name=name_parameter, value=value, format='str') | |
|
1597 | ||
|
1598 | opObj = puObj.addOperation(name='PowerProfilePlot', optype='other') | |
|
1765 | 1599 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1766 | ||
|
1767 | channelList = self.specGgraphChannelList.text() | |
|
1600 | ||
|
1768 | 1601 | if not channelList == '': |
|
1769 | 1602 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1770 | 1603 | |
|
1771 | xvalue = self.specGgraphDbsrange.text() | |
|
1772 |
|
|
|
1773 | xvalueList = xvalue.split(',') | |
|
1604 | if not db_range == '': | |
|
1605 | xvalueList = db_range.split(',') | |
|
1774 | 1606 | try: |
|
1775 | value = float(xvalueList[0]) | |
|
1776 | value = float(xvalueList[1]) | |
|
1607 | value1 = float(xvalueList[0]) | |
|
1608 | value2 = float(xvalueList[1]) | |
|
1777 | 1609 | except: |
|
1610 | self.console.clear() | |
|
1611 | self.console.append("Invalid db range") | |
|
1778 | 1612 | return 0 |
|
1779 |
|
|
|
1780 |
opObj.addParameter(name='xmin', value= |
|
|
1781 |
opObj.addParameter(name='xmax', value= |
|
|
1613 | ||
|
1614 | opObj.addParameter(name='xmin', value=value1, format='float') | |
|
1615 | opObj.addParameter(name='xmax', value=value2, format='float') | |
|
1782 | 1616 | |
|
1783 | yvalue = self.specGgraphHeight.text() | |
|
1784 | if not yvalue == '': | |
|
1785 | yvalueList = yvalue.split(",") | |
|
1786 | try: | |
|
1787 |
value = float(yvalueList[ |
|
|
1788 | value = float(yvalueList[1]) | |
|
1789 | except: | |
|
1790 | return 0 | |
|
1791 |
|
|
|
1792 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) | |
|
1793 |
opObj.addParameter(name='ym |
|
|
1794 | ||
|
1617 | if not hei_range == '': | |
|
1618 | yvalueList = hei_range.split(",") | |
|
1619 | try: | |
|
1620 | value1 = float(yvalueList[0]) | |
|
1621 | value2 = float(yvalueList[1]) | |
|
1622 | except: | |
|
1623 | self.console.clear() | |
|
1624 | self.console.append("Invalid height range") | |
|
1625 | return 0 | |
|
1626 | ||
|
1627 | opObj.addParameter(name='ymin', value=value1, format='float') | |
|
1628 | opObj.addParameter(name='ymax', value=value2, format='float') | |
|
1795 | 1629 | |
|
1796 | 1630 | if self.specGraphSavePowerprofile.isChecked(): |
|
1797 | checkPath = True | |
|
1798 | opObj.addParameter(name='save', value='1', format='bool') | |
|
1799 |
opObj.addParameter(name='figpath', value= |
|
|
1800 | value = self.specGraphPrefix.text() | |
|
1801 | if not value == "": | |
|
1802 |
|
|
|
1803 | value = str(self.specGraphPrefix.text()) | |
|
1804 | except: | |
|
1805 | self.console.clear() | |
|
1806 | self.console.append("Please Write prefix") | |
|
1807 | return 0 | |
|
1808 | opObj.addParameter(name='figfile', value=value, format='str') | |
|
1809 | ||
|
1631 | checkPath = True | |
|
1632 | opObj.addParameter(name='save', value='1', format='bool') | |
|
1633 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
|
1634 | if figfile: | |
|
1635 | opObj.addParameter(name='figfile', value=value, format='str') | |
|
1636 | if wrperiod: | |
|
1637 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
|
1810 | 1638 | |
|
1811 | 1639 | if self.specGraphftpPowerprofile.isChecked(): |
|
1812 | 1640 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1813 | 1641 | self.addFTPConf2Operation(puObj, opObj) |
|
1814 | 1642 | addFTP = True |
|
1815 | 1643 | # rti noise |
|
1816 | 1644 | |
|
1817 | 1645 | if self.specGraphCebRTInoise.isChecked(): |
|
1818 | name_operation = 'Noise' | |
|
1819 | optype = 'other' | |
|
1820 | name_parameter = 'type' | |
|
1821 | value = 'Noise' | |
|
1822 | format = 'str' | |
|
1823 | ||
|
1824 | if self.idImagrtinoise == 0: | |
|
1825 | self.idImagrtinoise = 700 | |
|
1826 | else: | |
|
1827 | self.idImagrtinoise = self.idImagrtinoise + 1 | |
|
1828 | 1646 | |
|
1829 | name_parameter1 = 'id' | |
|
1830 | value1 = int(self.idImagrtinoise) | |
|
1831 | format1 = 'int' | |
|
1832 | format = 'str' | |
|
1833 | ||
|
1834 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
|
1835 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
|
1836 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) | |
|
1837 | ||
|
1838 | channelList = self.specGgraphChannelList.text() | |
|
1839 | xvalue = self.specGgraphTminTmax.text() | |
|
1840 | yvalue = self.specGgraphDbsrange.text() | |
|
1841 | timerange = self.specGgraphTimeRange.text() | |
|
1842 | ||
|
1647 | opObj = puObj.addOperation(name='Noise', optype='other') | |
|
1648 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
|
1843 | 1649 | |
|
1844 | 1650 | if not channelList == '': |
|
1845 | 1651 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1846 | 1652 | |
|
1847 | if not timerange == '': | |
|
1848 |
|
|
|
1849 | try: | |
|
1850 | timerange = int(timerange) | |
|
1851 | except: | |
|
1852 | return 0 | |
|
1853 | opObj.addParameter(name='timerange', value=timerange, format=format) | |
|
1653 | # if not timerange == '': | |
|
1654 | # try: | |
|
1655 | # timerange = float(timerange) | |
|
1656 | # except: | |
|
1657 | # self.console.clear() | |
|
1658 | # self.console.append("Invalid time range") | |
|
1659 | # return 0 | |
|
1660 | # | |
|
1661 | # opObj.addParameter(name='timerange', value=timerange, format='float') | |
|
1854 | 1662 | |
|
1855 |
if not |
|
|
1856 |
xvalueList = |
|
|
1663 | if not trange == '': | |
|
1664 | xvalueList = trange.split(',') | |
|
1857 | 1665 | try: |
|
1858 | value = float(xvalueList[0]) | |
|
1859 | value = float(xvalueList[1]) | |
|
1666 | value1 = float(xvalueList[0]) | |
|
1667 | value2 = float(xvalueList[1]) | |
|
1860 | 1668 | except: |
|
1861 | return 0 | |
|
1862 | format = 'float' | |
|
1863 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) | |
|
1864 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) | |
|
1669 | self.console.clear() | |
|
1670 | self.console.append("Invalid time range") | |
|
1671 | return 0 | |
|
1672 | ||
|
1673 | opObj.addParameter(name='xmin', value=value1, format='float') | |
|
1674 | opObj.addParameter(name='xmax', value=value2, format='float') | |
|
1865 | 1675 | |
|
1866 |
if not |
|
|
1867 |
yvalueList = |
|
|
1676 | if not db_range == '': | |
|
1677 | yvalueList = db_range.split(",") | |
|
1868 | 1678 | try: |
|
1869 | value = float(yvalueList[0]) | |
|
1870 | value = float(yvalueList[1]) | |
|
1679 | value1 = float(yvalueList[0]) | |
|
1680 | value2 = float(yvalueList[1]) | |
|
1871 | 1681 | except: |
|
1872 | return 0 | |
|
1873 | format = 'float' | |
|
1874 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) | |
|
1875 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) | |
|
1682 | self.console.clear() | |
|
1683 | self.console.append("Invalid db range") | |
|
1684 | return 0 | |
|
1685 | ||
|
1686 | opObj.addParameter(name='ymin', value=value1, format='float') | |
|
1687 | opObj.addParameter(name='ymax', value=value2, format='float') | |
|
1876 | 1688 | |
|
1877 | 1689 | if self.specGraphSaveRTInoise.isChecked(): |
|
1878 | 1690 | checkPath = True |
|
1879 | 1691 | opObj.addParameter(name='save', value='1', format='bool') |
|
1880 |
opObj.addParameter(name='figpath', value= |
|
|
1881 | value = self.specGraphPrefix.text() | |
|
1882 | if not value == "": | |
|
1883 | try: | |
|
1884 | value = str(self.specGraphPrefix.text()) | |
|
1885 | except: | |
|
1886 | self.console.clear() | |
|
1887 | self.console.append("Please Write prefix") | |
|
1888 | return 0 | |
|
1692 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
|
1693 | if figfile: | |
|
1889 | 1694 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1890 | ||
|
1695 | if wrperiod: | |
|
1696 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
|
1697 | ||
|
1891 | 1698 | # test_ftp |
|
1892 | 1699 | if self.specGraphftpRTInoise.isChecked(): |
|
1893 | 1700 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1894 | 1701 | self.addFTPConf2Operation(puObj, opObj) |
|
1895 | 1702 | addFTP = True |
|
1896 | 1703 | |
|
1897 | localfolder = None | |
|
1898 | 1704 | if checkPath: |
|
1899 | localfolder = str(self.specGraphPath.text()) | |
|
1900 | if localfolder == '': | |
|
1705 | if not figpath: | |
|
1901 | 1706 | self.console.clear() |
|
1902 | 1707 | self.console.append("Graphic path should be defined") |
|
1903 | 1708 | return 0 |
|
1904 | 1709 | |
|
1905 | 1710 | if addFTP: |
|
1906 |
if not |
|
|
1711 | if not figpath: | |
|
1907 | 1712 | self.console.clear() |
|
1908 | 1713 | self.console.append("You have to save the plots before sending them to FTP Server") |
|
1909 | 1714 | return 0 |
|
1910 | 1715 | |
|
1911 | 1716 | if not self.temporalFTP.create: |
|
1912 | 1717 | self.temporalFTP.setwithoutconfiguration() |
|
1913 | 1718 | |
|
1914 | 1719 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.temporalFTP.recover() |
|
1915 | 1720 | self.addFTPProcUnitView(server, username, password, remotefolder, |
|
1916 | 1721 | ftp_wei, exp_code, sub_exp_code, plot_pos, |
|
1917 |
localfolder= |
|
|
1722 | localfolder=figpath) | |
|
1918 | 1723 | else: |
|
1919 | 1724 | self.removeFTPProcUnitView() |
|
1920 | 1725 | |
|
1921 | 1726 | # if something happend |
|
1922 | 1727 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Spectra') |
|
1923 | 1728 | if parms_ok: |
|
1924 |
|
|
|
1925 | optype = 'other' | |
|
1926 | name_parameter1 = 'path' | |
|
1927 | name_parameter2 = 'blocksPerFile' | |
|
1928 | name_parameter3 = 'profilesPerBlock' | |
|
1929 | value1 = output_path | |
|
1930 | value2 = blocksperfile | |
|
1931 | value3 = profilesperblock | |
|
1932 | format = "int" | |
|
1933 | ||
|
1934 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
|
1935 | opObj.addParameter(name=name_parameter1, value=value1) | |
|
1936 | opObj.addParameter(name=name_parameter2, value=value2, format=format) | |
|
1937 | opObj.addParameter(name=name_parameter3, value=value3, format=format) | |
|
1938 | ||
|
1939 | self.refreshPUProperties(puObj) | |
|
1940 | ||
|
1729 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') | |
|
1730 | opObj.addParameter(name='path', value=output_path) | |
|
1731 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') | |
|
1732 | opObj.addParameter(name='profilesPerBlock', value=profilesperblock, format='int') | |
|
1733 | ||
|
1941 | 1734 | self.console.clear() |
|
1735 | try: | |
|
1736 | self.refreshPUProperties(puObj) | |
|
1737 | except: | |
|
1738 | self.console.append("Check input parameters") | |
|
1739 | return 0 | |
|
1740 | ||
|
1942 | 1741 | self.console.append("If you want to save your project") |
|
1943 | 1742 | self.console.append("click on your project name in the Tree Project Explorer") |
|
1944 | 1743 | |
|
1945 | 1744 | self.actionSaveToolbar.setEnabled(True) |
|
1946 | 1745 | self.actionStarToolbar.setEnabled(True) |
|
1947 | 1746 | |
|
1948 | 1747 | return 1 |
|
1949 | 1748 | |
|
1950 | 1749 | """ |
|
1951 | 1750 | Spectra Graph |
|
1952 | 1751 | """ |
|
1953 | 1752 | @pyqtSignature("int") |
|
1954 | 1753 | def on_specGraphCebSpectraplot_stateChanged(self, p0): |
|
1955 | 1754 | |
|
1956 | if p0 == 2: | |
|
1957 | self.specGgraphChannelList.setEnabled(True) | |
|
1958 | self.specGgraphFreq.setEnabled(True) | |
|
1959 | self.specGgraphHeight.setEnabled(True) | |
|
1960 | self.specGgraphDbsrange.setEnabled(True) | |
|
1961 | if p0 == 0: | |
|
1962 | self.specGgraphFreq.setEnabled(False) | |
|
1963 | self.specGgraphHeight.setEnabled(False) | |
|
1964 | self.specGgraphDbsrange.setEnabled(False) | |
|
1755 | self.__checkSpecGraphFilters() | |
|
1965 | 1756 | |
|
1966 | 1757 | |
|
1967 | 1758 | @pyqtSignature("int") |
|
1968 | 1759 | def on_specGraphCebCrossSpectraplot_stateChanged(self, p0): |
|
1969 | 1760 | |
|
1970 | if p0 == 2: | |
|
1971 | self.specGgraphFreq.setEnabled(True) | |
|
1972 | self.specGgraphHeight.setEnabled(True) | |
|
1973 | self.specGgraphDbsrange.setEnabled(True) | |
|
1974 | if p0 == 0: | |
|
1975 | self.specGgraphFreq.setEnabled(False) | |
|
1976 | self.specGgraphHeight.setEnabled(False) | |
|
1977 | self.specGgraphDbsrange.setEnabled(False) | |
|
1761 | self.__checkSpecGraphFilters() | |
|
1978 | 1762 | |
|
1979 | 1763 | @pyqtSignature("int") |
|
1980 | 1764 | def on_specGraphCebRTIplot_stateChanged(self, p0): |
|
1981 | 1765 | |
|
1982 | if p0 == 2: | |
|
1983 | self.specGgraphChannelList.setEnabled(True) | |
|
1984 | self.specGgraphTminTmax.setEnabled(True) | |
|
1985 | self.specGgraphHeight.setEnabled(True) | |
|
1986 | self.specGgraphDbsrange.setEnabled(True) | |
|
1987 | self.specGgraphTimeRange.setEnabled(True) | |
|
1988 | ||
|
1989 | if p0 == 0: | |
|
1990 | self.specGgraphTminTmax.setEnabled(False) | |
|
1991 | self.specGgraphHeight.setEnabled(False) | |
|
1992 | self.specGgraphDbsrange.setEnabled(False) | |
|
1993 | self.specGgraphTimeRange.setEnabled(False) | |
|
1766 | self.__checkSpecGraphFilters() | |
|
1994 | 1767 | |
|
1995 | 1768 | |
|
1996 | 1769 | @pyqtSignature("int") |
|
1997 | 1770 | def on_specGraphCebRTInoise_stateChanged(self, p0): |
|
1998 |
|
|
|
1999 | self.specGgraphChannelList.setEnabled(True) | |
|
2000 | self.specGgraphTminTmax.setEnabled(True) | |
|
2001 | self.specGgraphDbsrange.setEnabled(True) | |
|
2002 | self.specGgraphTimeRange.setEnabled(True) | |
|
2003 | ||
|
2004 | if p0 == 0: | |
|
2005 | self.specGgraphTminTmax.setEnabled(False) | |
|
2006 | self.specGgraphDbsrange.setEnabled(False) | |
|
2007 | self.specGgraphTimeRange.setEnabled(False) | |
|
2008 | ||
|
2009 | ||
|
1771 | ||
|
1772 | self.__checkSpecGraphFilters() | |
|
2010 | 1773 | |
|
2011 | 1774 | |
|
2012 | 1775 | @pyqtSignature("int") |
|
2013 | 1776 | def on_specGraphCebCoherencmap_stateChanged(self, p0): |
|
2014 | 1777 | |
|
2015 | if p0 == 2: | |
|
2016 | self.specGgraphTminTmax.setEnabled(True) | |
|
2017 | self.specGgraphHeight.setEnabled(True) | |
|
2018 | self.specGgraphmagnitud.setEnabled(True) | |
|
2019 | self.specGgraphTimeRange.setEnabled(True) | |
|
2020 | ||
|
2021 | if p0 == 0: | |
|
2022 | self.specGgraphTminTmax.setEnabled(False) | |
|
2023 | self.specGgraphHeight.setEnabled(False) | |
|
2024 | self.specGgraphmagnitud.setEnabled(False) | |
|
2025 | self.specGgraphTimeRange.setEnabled(False) | |
|
2026 | ||
|
2027 | ||
|
2028 | ||
|
1778 | self.__checkSpecGraphFilters() | |
|
2029 | 1779 | |
|
2030 | 1780 | @pyqtSignature("int") |
|
2031 | 1781 | def on_specGraphPowerprofile_stateChanged(self, p0): |
|
2032 | 1782 | |
|
2033 | if p0 == 2: | |
|
2034 | ||
|
2035 | self.specGgraphHeight.setEnabled(True) | |
|
2036 | self.specGgraphDbsrange.setEnabled(True) | |
|
2037 | if p0 == 0: | |
|
2038 | self.specGgraphHeight.setEnabled(False) | |
|
2039 | self.specGgraphDbsrange.setEnabled(False) | |
|
1783 | self.__checkSpecGraphFilters() | |
|
2040 | 1784 | |
|
2041 | 1785 | @pyqtSignature("int") |
|
2042 | 1786 | def on_specGraphPhase_stateChanged(self, p0): |
|
2043 | 1787 | |
|
2044 | if p0 == 2: | |
|
2045 | self.specGgraphTminTmax.setEnabled(True) | |
|
2046 | self.specGgraphPhaserange.setEnabled(True) | |
|
2047 | ||
|
2048 | if p0 == 0: | |
|
2049 | self.specGgraphTminTmax.setEnabled(False) | |
|
2050 | self.specGgraphPhaserange.setEnabled(False) | |
|
1788 | self.__checkSpecGraphFilters() | |
|
2051 | 1789 | |
|
2052 | 1790 | @pyqtSignature("int") |
|
2053 | 1791 | def on_specGraphSaveSpectra_stateChanged(self, p0): |
|
2054 | 1792 | """ |
|
2055 | 1793 | """ |
|
2056 | if p0 == 2: | |
|
2057 | self.specGraphPath.setEnabled(True) | |
|
2058 | self.specGraphPrefix.setEnabled(True) | |
|
2059 | self.specGraphToolPath.setEnabled(True) | |
|
2060 | if p0 == 0: | |
|
2061 | self.specGraphPath.setEnabled(False) | |
|
2062 | self.specGraphPrefix.setEnabled(False) | |
|
2063 | self.specGraphToolPath.setEnabled(False) | |
|
2064 | ||
|
2065 | ||
|
1794 | self.__checkSpecGraphSaving() | |
|
1795 | ||
|
2066 | 1796 | @pyqtSignature("int") |
|
2067 | 1797 | def on_specGraphSaveCross_stateChanged(self, p0): |
|
2068 |
|
|
|
2069 |
|
|
|
2070 | self.specGraphPrefix.setEnabled(True) | |
|
2071 | self.specGraphToolPath.setEnabled(True) | |
|
1798 | ||
|
1799 | self.__checkSpecGraphSaving() | |
|
2072 | 1800 | |
|
2073 | 1801 | @pyqtSignature("int") |
|
2074 | 1802 | def on_specGraphSaveRTIplot_stateChanged(self, p0): |
|
2075 |
|
|
|
2076 |
|
|
|
2077 | self.specGraphPrefix.setEnabled(True) | |
|
2078 | self.specGraphToolPath.setEnabled(True) | |
|
1803 | ||
|
1804 | self.__checkSpecGraphSaving() | |
|
2079 | 1805 | |
|
2080 | 1806 | @pyqtSignature("int") |
|
2081 | 1807 | def on_specGraphSaveRTInoise_stateChanged(self, p0): |
|
2082 |
|
|
|
2083 |
|
|
|
2084 | self.specGraphPrefix.setEnabled(True) | |
|
2085 | self.specGraphToolPath.setEnabled(True) | |
|
1808 | ||
|
1809 | self.__checkSpecGraphSaving() | |
|
2086 | 1810 | |
|
2087 | 1811 | @pyqtSignature("int") |
|
2088 | 1812 | def on_specGraphSaveCoherencemap_stateChanged(self, p0): |
|
2089 |
|
|
|
2090 |
|
|
|
2091 | self.specGraphPrefix.setEnabled(True) | |
|
2092 | self.specGraphToolPath.setEnabled(True) | |
|
2093 | ||
|
1813 | ||
|
1814 | self.__checkSpecGraphSaving() | |
|
2094 | 1815 | |
|
2095 | 1816 | @pyqtSignature("int") |
|
2096 | 1817 | def on_specGraphSavePowerprofile_stateChanged(self, p0): |
|
2097 |
|
|
|
2098 |
|
|
|
2099 | self.specGraphPrefix.setEnabled(True) | |
|
2100 | self.specGraphToolPath.setEnabled(True) | |
|
1818 | ||
|
1819 | self.__checkSpecGraphSaving() | |
|
2101 | 1820 | |
|
2102 | 1821 | @pyqtSignature("int") |
|
2103 | 1822 | def on_specGraphftpSpectra_stateChanged(self, p0): |
|
2104 | 1823 | """ |
|
2105 | 1824 | """ |
|
2106 | if p0 == 2: | |
|
2107 | self.specGgraphftpratio.setEnabled(True) | |
|
2108 | ||
|
2109 | if p0 == 0: | |
|
2110 | self.specGgraphftpratio.setEnabled(False) | |
|
1825 | self.__checkSpecGraphFTP() | |
|
2111 | 1826 | |
|
2112 | 1827 | |
|
2113 | 1828 | @pyqtSignature("int") |
|
2114 | 1829 | def on_specGraphftpCross_stateChanged(self, p0): |
|
2115 |
|
|
|
2116 | self.specGgraphftpratio.setEnabled(True) | |
|
1830 | ||
|
1831 | self.__checkSpecGraphFTP() | |
|
2117 | 1832 | |
|
2118 | 1833 | @pyqtSignature("int") |
|
2119 | 1834 | def on_specGraphftpRTIplot_stateChanged(self, p0): |
|
2120 |
|
|
|
2121 | self.specGgraphftpratio.setEnabled(True) | |
|
1835 | ||
|
1836 | self.__checkSpecGraphFTP() | |
|
2122 | 1837 | |
|
2123 | 1838 | @pyqtSignature("int") |
|
2124 | 1839 | def on_specGraphftpRTInoise_stateChanged(self, p0): |
|
2125 |
|
|
|
2126 | self.specGgraphftpratio.setEnabled(True) | |
|
1840 | ||
|
1841 | self.__checkSpecGraphFTP() | |
|
2127 | 1842 | |
|
2128 | 1843 | @pyqtSignature("int") |
|
2129 | 1844 | def on_specGraphftpCoherencemap_stateChanged(self, p0): |
|
2130 |
|
|
|
2131 | self.specGgraphftpratio.setEnabled(True) | |
|
1845 | ||
|
1846 | self.__checkSpecGraphFTP() | |
|
2132 | 1847 | |
|
2133 | 1848 | @pyqtSignature("int") |
|
2134 | 1849 | def on_specGraphftpPowerprofile_stateChanged(self, p0): |
|
2135 |
|
|
|
2136 | self.specGgraphftpratio.setEnabled(True) | |
|
1850 | ||
|
1851 | self.__checkSpecGraphFTP() | |
|
2137 | 1852 | |
|
2138 | 1853 | @pyqtSignature("") |
|
2139 | 1854 | def on_specGraphToolPath_clicked(self): |
|
2140 | 1855 | """ |
|
2141 | 1856 | """ |
|
2142 | 1857 | self.savePath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
2143 | 1858 | self.specGraphPath.setText(self.savePath) |
|
2144 | 1859 | if not os.path.exists(self.savePath): |
|
2145 | 1860 | self.console.clear() |
|
2146 | 1861 | self.console.append("Write a correct a path") |
|
2147 | 1862 | return |
|
2148 | 1863 | |
|
2149 | 1864 | @pyqtSignature("") |
|
1865 | def on_specGraphClear_clicked(self): | |
|
1866 | return | |
|
1867 | ||
|
1868 | @pyqtSignature("") | |
|
2150 | 1869 | def on_specHeisGraphToolPath_clicked(self): |
|
2151 | 1870 | """ |
|
2152 | 1871 | """ |
|
2153 | 1872 | self.savePath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
2154 | 1873 | self.specHeisGraphPath.setText(self.savePath) |
|
2155 | 1874 | if not os.path.exists(self.savePath): |
|
2156 | 1875 | self.console.clear() |
|
2157 | 1876 | self.console.append("Write a correct a path") |
|
2158 |
return |
|
|
2159 | ||
|
2160 | @pyqtSignature("") | |
|
2161 | def on_specGraphClear_clicked(self): | |
|
2162 | self.clearspecGraph() | |
|
1877 | return | |
|
2163 | 1878 | |
|
2164 | 1879 | @pyqtSignature("int") |
|
2165 | 1880 | def on_specHeisOpCebIncoherent_stateChanged(self, p0): |
|
2166 | 1881 | """ |
|
2167 | 1882 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
2168 | 1883 | """ |
|
2169 | 1884 | if p0 == 2: |
|
2170 | 1885 | self.specHeisOpIncoherent.setEnabled(True) |
|
2171 | 1886 | self.specHeisOpCobIncInt.setEnabled(True) |
|
2172 | 1887 | if p0 == 0: |
|
2173 | 1888 | self.specHeisOpIncoherent.setEnabled(False) |
|
2174 | 1889 | self.specHeisOpCobIncInt.setEnabled(False) |
|
2175 | 1890 | |
|
2176 | 1891 | @pyqtSignature("") |
|
2177 | 1892 | def on_specHeisOpOk_clicked(self): |
|
2178 | 1893 | """ |
|
2179 | 1894 | AΓADE OPERACION SPECTRAHEIS |
|
2180 | 1895 | """ |
|
2181 | 1896 | addFTP = False |
|
2182 | 1897 | checkPath = False |
|
2183 | 1898 | |
|
2184 | 1899 | self.actionSaveToolbar.setEnabled(False) |
|
2185 | 1900 | self.actionStarToolbar.setEnabled(False) |
|
2186 | 1901 | |
|
2187 | 1902 | puObj = self.getSelectedItemObj() |
|
2188 | 1903 | puObj.removeOperations() |
|
2189 | 1904 | |
|
2190 | 1905 | if self.specHeisOpCebIncoherent.isChecked(): |
|
2191 | 1906 | value = self.specHeisOpIncoherent.text() |
|
2192 | 1907 | name_operation = 'IncohInt4SpectraHeis' |
|
2193 | 1908 | optype = 'other' |
|
2194 | 1909 | if self.specOpCobIncInt.currentIndex() == 0: |
|
2195 | 1910 | name_parameter = 'timeInterval' |
|
2196 | 1911 | format = 'float' |
|
2197 | 1912 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2198 | 1913 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
2199 | 1914 | |
|
2200 | 1915 | # ---- Spectra Plot----- |
|
2201 | 1916 | if self.specHeisGraphCebSpectraplot.isChecked(): |
|
2202 | 1917 | name_operation = 'SpectraHeisScope' |
|
2203 | 1918 | optype = 'other' |
|
2204 | 1919 | name_parameter = 'type' |
|
2205 | 1920 | value = 'SpectraHeisScope' |
|
2206 | 1921 | format = 'str' |
|
2207 | 1922 | if self.idImagspectraHeis == 0: |
|
2208 | 1923 | self.idImagspectraHeis = 800 |
|
2209 | 1924 | else: |
|
2210 | 1925 | self.idImagspectraHeis = self.idImagspectraHeis + 1 |
|
2211 | 1926 | name_parameter1 = 'id' |
|
2212 | 1927 | value1 = int(self.idImagspectraHeis) |
|
2213 | 1928 | format1 = 'int' |
|
2214 | 1929 | |
|
2215 | 1930 | format = 'str' |
|
2216 | 1931 | |
|
2217 | 1932 | channelList = self.specHeisGgraphChannelList.text() |
|
2218 | 1933 | xvalue = self.specHeisGgraphXminXmax.text() |
|
2219 | 1934 | yvalue = self.specHeisGgraphYminYmax.text() |
|
2220 | 1935 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2221 | 1936 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
2222 | 1937 | opObj.addParameter(name=name_parameter1, value=value1, format=format1) |
|
2223 | 1938 | |
|
2224 | 1939 | if not channelList == '': |
|
2225 | 1940 | name_parameter = 'channelList' |
|
2226 | 1941 | format = 'intlist' |
|
2227 | 1942 | opObj.addParameter(name=name_parameter, value=channelList, format=format) |
|
2228 | 1943 | |
|
2229 | 1944 | if not xvalue == '': |
|
2230 | 1945 | xvalueList = xvalue.split(',') |
|
2231 | 1946 | try: |
|
2232 | 1947 | value1 = float(xvalueList[0]) |
|
2233 | 1948 | value2 = float(xvalueList[1]) |
|
2234 | 1949 | except: |
|
2235 | 1950 | self.console.clear() |
|
2236 | 1951 | self.console.append("Please Write corrects parameter xmin-xmax") |
|
2237 | 1952 | return 0 |
|
2238 | 1953 | name1 = 'xmin' |
|
2239 | 1954 | name2 = 'xmax' |
|
2240 | 1955 | format = 'float' |
|
2241 | 1956 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2242 | 1957 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2243 | 1958 | #------specHeisGgraphYmin-Ymax--- |
|
2244 | 1959 | if not yvalue == '': |
|
2245 | 1960 | yvalueList = yvalue.split(",") |
|
2246 | 1961 | try: |
|
2247 | 1962 | value1 = float(yvalueList[0]) |
|
2248 | 1963 | value2 = float(yvalueList[1]) |
|
2249 | 1964 | except: |
|
2250 | 1965 | self.console.clear() |
|
2251 | 1966 | self.console.append("Please Write corrects parameter Ymix-Ymax") |
|
2252 | 1967 | return 0 |
|
2253 | 1968 | name1 = 'ymin' |
|
2254 | 1969 | name2 = 'ymax' |
|
2255 | 1970 | format = 'float' |
|
2256 | 1971 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2257 | 1972 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2258 | 1973 | |
|
2259 | 1974 | if self.specHeisGraphSaveSpectra.isChecked(): |
|
2260 | 1975 | checkPath = True |
|
2261 | 1976 | name_parameter1 = 'save' |
|
2262 | 1977 | name_parameter2 = 'figpath' |
|
2263 | 1978 | name_parameter3 = 'figfile' |
|
2264 | 1979 | value1 = '1' |
|
2265 | 1980 | value2 = self.specHeisGraphPath.text() |
|
2266 | 1981 | value3 = self.specHeisGraphPrefix.text() |
|
2267 | 1982 | format1 = 'bool' |
|
2268 | 1983 | format2 = 'str' |
|
2269 | 1984 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) |
|
2270 | 1985 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2271 | 1986 | if not value3 == "": |
|
2272 | 1987 | try: |
|
2273 | 1988 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2274 | 1989 | except: |
|
2275 | 1990 | self.console.clear() |
|
2276 | 1991 | self.console.append("Please Write prefix") |
|
2277 | 1992 | return 0 |
|
2278 | 1993 | opObj.addParameter(name='figfile', value=self.specHeisGraphPrefix.text(), format='str') |
|
2279 | 1994 | |
|
2280 | 1995 | # opObj.addParameter(name=name_parameter3, value=value3, format=format2) |
|
2281 | 1996 | # opObj.addParameter(name='wr_period', value='5',format='int') |
|
2282 | 1997 | |
|
2283 | 1998 | if self.specHeisGraphftpSpectra.isChecked(): |
|
2284 | 1999 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2285 | 2000 | self.addFTPConf2Operation(puObj, opObj) |
|
2286 | 2001 | addFTP = True |
|
2287 | 2002 | |
|
2288 | 2003 | if self.specHeisGraphCebRTIplot.isChecked(): |
|
2289 | 2004 | name_operation = 'RTIfromSpectraHeis' |
|
2290 | 2005 | optype = 'other' |
|
2291 | 2006 | name_parameter = 'type' |
|
2292 | 2007 | value = 'RTIfromSpectraHeis' |
|
2293 | 2008 | format = 'str' |
|
2294 | 2009 | |
|
2295 | 2010 | if self.idImagrtiHeis == 0: |
|
2296 | 2011 | self.idImagrtiHeis = 900 |
|
2297 | 2012 | else: |
|
2298 | 2013 | self.idImagrtiHeis = self.idImagrtiHeis + 1 |
|
2299 | 2014 | |
|
2300 | 2015 | name_parameter1 = 'id' |
|
2301 | 2016 | value1 = int(self.idImagrtiHeis) |
|
2302 | 2017 | format1 = 'int' |
|
2303 | 2018 | |
|
2304 | 2019 | format = 'str' |
|
2305 | 2020 | |
|
2306 | 2021 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2307 | 2022 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
2308 | 2023 | opObj.addParameter(name=name_parameter1, value=value1, format=format1) |
|
2309 | 2024 | |
|
2310 | 2025 | channelList = self.specHeisGgraphChannelList.text() |
|
2311 | 2026 | xvalue = self.specHeisGgraphTminTmax.text() |
|
2312 | 2027 | yvalue = self.specHeisGgraphYminYmax.text() |
|
2313 | 2028 | timerange = self.specHeisGgraphTimeRange.text() |
|
2314 | 2029 | |
|
2315 | 2030 | if not channelList == '': |
|
2316 | 2031 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
2317 | 2032 | |
|
2318 | 2033 | if not xvalue == '': |
|
2319 | 2034 | xvalueList = xvalue.split(',') |
|
2320 | 2035 | try: |
|
2321 | 2036 | value = float(xvalueList[0]) |
|
2322 | 2037 | value = float(xvalueList[1]) |
|
2323 | 2038 | except: |
|
2324 | 2039 | return 0 |
|
2325 | 2040 | format = 'float' |
|
2326 | 2041 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) |
|
2327 | 2042 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) |
|
2328 | 2043 | |
|
2329 | 2044 | if not timerange == '': |
|
2330 | 2045 | format = 'int' |
|
2331 | 2046 | try: |
|
2332 | 2047 | timerange = int(timerange) |
|
2333 | 2048 | except: |
|
2334 | 2049 | return 0 |
|
2335 | 2050 | opObj.addParameter(name='timerange', value=timerange, format=format) |
|
2336 | 2051 | |
|
2337 | 2052 | |
|
2338 | 2053 | if not yvalue == '': |
|
2339 | 2054 | yvalueList = yvalue.split(",") |
|
2340 | 2055 | try: |
|
2341 | 2056 | value = float(yvalueList[0]) |
|
2342 | 2057 | value = float(yvalueList[1]) |
|
2343 | 2058 | except: |
|
2344 | 2059 | return 0 |
|
2345 | 2060 | format = 'float' |
|
2346 | 2061 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) |
|
2347 | 2062 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) |
|
2348 | 2063 | |
|
2349 | 2064 | if self.specHeisGraphSaveRTIplot.isChecked(): |
|
2350 | 2065 | checkPath = True |
|
2351 | 2066 | opObj.addParameter(name='save', value='1', format='bool') |
|
2352 | 2067 | opObj.addParameter(name='figpath', value=self.specHeisGraphPath.text(), format='str') |
|
2353 | 2068 | value = self.specHeisGraphPrefix.text() |
|
2354 | 2069 | if not value == "": |
|
2355 | 2070 | try: |
|
2356 | 2071 | value = str(self.specHeisGraphPrefix.text()) |
|
2357 | 2072 | except: |
|
2358 | 2073 | self.console.clear() |
|
2359 | 2074 | self.console.append("Please Write prefix") |
|
2360 | 2075 | return 0 |
|
2361 | 2076 | opObj.addParameter(name='figfile', value=value, format='str') |
|
2362 | 2077 | |
|
2363 | 2078 | # test_ftp |
|
2364 | 2079 | if self.specHeisGraphftpRTIplot.isChecked(): |
|
2365 | 2080 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2366 | 2081 | self.addFTPConf2Operation(puObj, opObj) |
|
2367 | 2082 | addFTP = True |
|
2368 | 2083 | |
|
2369 | 2084 | localfolder = None |
|
2370 | 2085 | if checkPath: |
|
2371 | 2086 | localfolder = str(self.specGraphPath.text()) |
|
2372 | 2087 | if localfolder == '': |
|
2373 | 2088 | self.console.clear() |
|
2374 | 2089 | self.console.append("Graphic path should be defined") |
|
2375 | 2090 | return 0 |
|
2376 | 2091 | |
|
2377 | 2092 | if addFTP: |
|
2378 | 2093 | if not localfolder: |
|
2379 | 2094 | self.console.clear() |
|
2380 | 2095 | self.console.append("You have to save the plots before sending them to FTP Server") |
|
2381 | 2096 | return 0 |
|
2382 | 2097 | |
|
2383 | 2098 | if not self.temporalFTP.create: |
|
2384 | 2099 | self.temporalFTP.setwithoutconfiguration() |
|
2385 | 2100 | |
|
2386 | 2101 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.temporalFTP.recover() |
|
2387 | 2102 | self.addFTPProcUnitView(server, username, password, remotefolder, |
|
2388 | 2103 | ftp_wei, exp_code, sub_exp_code, plot_pos, |
|
2389 | 2104 | localfolder=localfolder) |
|
2390 | 2105 | else: |
|
2391 | 2106 | self.removeFTPProcUnitView() |
|
2392 | 2107 | |
|
2393 | 2108 | # if something happened |
|
2394 | 2109 | parms_ok, output_path, blocksperfile, metada = self.checkInputsPUSave(datatype='SpectraHeis') |
|
2395 | 2110 | if parms_ok: |
|
2396 | 2111 | name_operation = 'FitsWriter' |
|
2397 | 2112 | optype = 'other' |
|
2398 | 2113 | name_parameter1 = 'path' |
|
2399 | 2114 | name_parameter2 = 'dataBlocksPerFile' |
|
2400 | 2115 | name_parameter3 = 'metadatafile' |
|
2401 | 2116 | value1 = output_path |
|
2402 | 2117 | value2 = blocksperfile |
|
2403 | 2118 | value3 = metada |
|
2404 | 2119 | format2 = "int" |
|
2405 | 2120 | format3 = "str" |
|
2406 | 2121 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2407 | 2122 | opObj.addParameter(name=name_parameter1, value=value1) |
|
2408 | 2123 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2409 | 2124 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) |
|
2410 | 2125 | |
|
2411 | self.refreshPUProperties(puObj) | |
|
2412 | ||
|
2413 | 2126 | self.console.clear() |
|
2127 | try: | |
|
2128 | self.refreshPUProperties(puObj) | |
|
2129 | except: | |
|
2130 | self.console.append("Check input parameters") | |
|
2131 | return 0 | |
|
2132 | ||
|
2414 | 2133 | self.console.append("Click on save icon ff you want to save your project") |
|
2415 | 2134 | |
|
2416 | 2135 | self.actionSaveToolbar.setEnabled(True) |
|
2417 | 2136 | self.actionStarToolbar.setEnabled(True) |
|
2418 | 2137 | |
|
2419 | 2138 | return 1 |
|
2420 | 2139 | @pyqtSignature("int") |
|
2421 | 2140 | def on_specHeisGraphCebSpectraplot_stateChanged(self, p0): |
|
2422 | 2141 | |
|
2423 | 2142 | if p0 == 2: |
|
2424 | 2143 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2425 | 2144 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
2426 | 2145 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2427 | 2146 | if p0 == 0: |
|
2428 | 2147 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
2429 | 2148 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2430 | 2149 | |
|
2431 | 2150 | @pyqtSignature("int") |
|
2432 | 2151 | def on_specHeisGraphCebRTIplot_stateChanged(self, p0): |
|
2433 | 2152 | |
|
2434 | 2153 | if p0 == 2: |
|
2435 | 2154 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2436 | 2155 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
2437 | 2156 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2438 | 2157 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
2439 | 2158 | |
|
2440 | 2159 | if p0 == 0: |
|
2441 | 2160 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
2442 | 2161 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2443 | 2162 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
2444 | 2163 | |
|
2445 | 2164 | @pyqtSignature("int") |
|
2446 | 2165 | def on_specHeisGraphSaveSpectra_stateChanged(self, p0): |
|
2447 | 2166 | """ |
|
2448 | 2167 | """ |
|
2449 | 2168 | if p0 == 2: |
|
2450 | 2169 | self.specHeisGraphPath.setEnabled(True) |
|
2451 | 2170 | self.specHeisGraphPrefix.setEnabled(True) |
|
2452 | 2171 | self.specHeisGraphToolPath.setEnabled(True) |
|
2453 | 2172 | if p0 == 0: |
|
2454 | 2173 | self.specHeisGraphPath.setEnabled(False) |
|
2455 | 2174 | self.specHeisGraphPrefix.setEnabled(False) |
|
2456 | 2175 | self.specHeisGraphToolPath.setEnabled(False) |
|
2457 | 2176 | |
|
2458 | 2177 | @pyqtSignature("int") |
|
2459 | 2178 | def on_specHeisGraphSaveRTIplot_stateChanged(self, p0): |
|
2460 | 2179 | if p0 == 2: |
|
2461 | 2180 | self.specHeisGraphPath.setEnabled(True) |
|
2462 | 2181 | self.specHeisGraphPrefix.setEnabled(True) |
|
2463 | 2182 | self.specHeisGraphToolPath.setEnabled(True) |
|
2464 | 2183 | |
|
2465 | 2184 | @pyqtSignature("int") |
|
2466 | 2185 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): |
|
2467 | 2186 | """ |
|
2468 | 2187 | """ |
|
2469 | 2188 | if p0 == 2: |
|
2470 | 2189 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2471 | 2190 | |
|
2472 | 2191 | if p0 == 0: |
|
2473 | 2192 | self.specHeisGgraphftpratio.setEnabled(False) |
|
2474 | 2193 | |
|
2475 | 2194 | @pyqtSignature("int") |
|
2476 | 2195 | def on_specHeisGraphftpRTIplot_stateChanged(self, p0): |
|
2477 | 2196 | if p0 == 2: |
|
2478 | 2197 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2479 | 2198 | |
|
2480 | 2199 | @pyqtSignature("") |
|
2481 | 2200 | def on_specHeisGraphClear_clicked(self): |
|
2482 | 2201 | pass |
|
2483 | 2202 | |
|
2484 | def __getParmsFromProjectWindow(self): | |
|
2485 |
|
|
|
2486 | Check Inputs Project: | |
|
2487 | - project_name | |
|
2488 | - datatype | |
|
2489 | - ext | |
|
2490 |
|
|
|
2491 | - readmode | |
|
2492 | - delay | |
|
2203 | def __checkSpecGraphSaving(self): | |
|
2204 | ||
|
2205 | enable = False | |
|
2206 | ||
|
2207 | if self.specGraphSaveSpectra.checkState(): | |
|
2208 | enable = True | |
|
2209 | ||
|
2210 | if self.specGraphSaveCross.checkState(): | |
|
2211 | enable = True | |
|
2212 | ||
|
2213 | if self.specGraphSaveRTIplot.checkState(): | |
|
2214 | enable = True | |
|
2215 | ||
|
2216 | if self.specGraphSaveCoherencemap.checkState(): | |
|
2217 | enable = True | |
|
2218 | ||
|
2219 | if self.specGraphSavePowerprofile.checkState(): | |
|
2220 | enable = True | |
|
2221 | ||
|
2222 | if self.specGraphSaveRTInoise.checkState(): | |
|
2223 | enable = True | |
|
2224 | ||
|
2225 | self.specGraphPath.setEnabled(enable) | |
|
2226 | self.specGraphPrefix.setEnabled(enable) | |
|
2227 | self.specGraphToolPath.setEnabled(enable) | |
|
2228 | ||
|
2229 | self.specGgraphftpratio.setEnabled(enable) | |
|
2230 | ||
|
2231 | def __checkSpecGraphFTP(self): | |
|
2232 | ||
|
2233 | enable = False | |
|
2234 | ||
|
2235 | if self.specGraphftpSpectra.checkState(): | |
|
2236 | enable = True | |
|
2237 | ||
|
2238 | if self.specGraphftpCross.checkState(): | |
|
2239 | enable = True | |
|
2240 | ||
|
2241 | if self.specGraphftpRTIplot.checkState(): | |
|
2242 | enable = True | |
|
2243 | ||
|
2244 | if self.specGraphftpCoherencemap.checkState(): | |
|
2245 | enable = True | |
|
2246 | ||
|
2247 | if self.specGraphftpPowerprofile.checkState(): | |
|
2248 | enable = True | |
|
2249 | ||
|
2250 | if self.specGraphftpRTInoise.checkState(): | |
|
2251 | enable = True | |
|
2252 | ||
|
2253 | # self.specGgraphftpratio.setEnabled(enable) | |
|
2254 | ||
|
2255 | def __checkSpecGraphFilters(self): | |
|
2256 | ||
|
2257 | freq = False | |
|
2258 | height = False | |
|
2259 | db = False | |
|
2260 | time = False | |
|
2261 | magnitud = False | |
|
2262 | phase = False | |
|
2263 | channelList = False | |
|
2264 | ||
|
2265 | if self.specGraphCebSpectraplot.checkState(): | |
|
2266 | freq = True | |
|
2267 | height = True | |
|
2268 | db = True | |
|
2269 | channelList = True | |
|
2270 | ||
|
2271 | if self.specGraphCebCrossSpectraplot.checkState(): | |
|
2272 | freq = True | |
|
2273 | height = True | |
|
2274 | db = True | |
|
2275 | magnitud = True | |
|
2276 | phase = True | |
|
2277 | ||
|
2278 | if self.specGraphCebRTIplot.checkState(): | |
|
2279 | height = True | |
|
2280 | db = True | |
|
2281 | time = True | |
|
2282 | channelList = True | |
|
2283 | ||
|
2284 | if self.specGraphCebCoherencmap.checkState(): | |
|
2285 | height = True | |
|
2286 | time = True | |
|
2287 | magnitud = True | |
|
2288 | phase = True | |
|
2289 | ||
|
2290 | if self.specGraphPowerprofile.checkState(): | |
|
2291 | height = True | |
|
2292 | db = True | |
|
2293 | channelList = True | |
|
2294 | ||
|
2295 | if self.specGraphCebRTInoise.checkState(): | |
|
2296 | db = True | |
|
2297 | time = True | |
|
2298 | channelList = True | |
|
2299 | ||
|
2300 | ||
|
2301 | self.specGgraphFreq.setEnabled(freq) | |
|
2302 | self.specGgraphHeight.setEnabled(height) | |
|
2303 | self.specGgraphDbsrange.setEnabled(db) | |
|
2304 | self.specGgraphTminTmax.setEnabled(time) | |
|
2305 | ||
|
2306 | self.specGgraphmagnitud.setEnabled(magnitud) | |
|
2307 | self.specGgraphPhase.setEnabled(phase) | |
|
2308 | self.specGgraphChannelList.setEnabled(channelList) | |
|
2309 | ||
|
2310 | def __getParmsFromProjectWindow(self): | |
|
2311 | """ | |
|
2312 | Check Inputs Project: | |
|
2313 | - project_name | |
|
2314 | - datatype | |
|
2315 | - ext | |
|
2316 | - data_path | |
|
2317 | - readmode | |
|
2318 | - delay | |
|
2493 | 2319 | - set |
|
2494 | 2320 | - walk |
|
2495 | 2321 | """ |
|
2496 | 2322 | parms_ok = True |
|
2497 | 2323 | |
|
2498 | 2324 | project_name = str(self.proName.text()) |
|
2499 | 2325 | |
|
2500 | 2326 | if project_name == '' or project_name == None: |
|
2501 | 2327 | outputstr = "Enter a project Name" |
|
2502 | 2328 | self.console.append(outputstr) |
|
2503 | 2329 | parms_ok = False |
|
2504 | 2330 | project_name = None |
|
2505 | 2331 | |
|
2506 | 2332 | description = str(self.proDescription.toPlainText()) |
|
2507 | 2333 | |
|
2508 | 2334 | datatype = str(self.proComDataType.currentText()) |
|
2509 | 2335 | |
|
2510 | 2336 | ext = str(self.proDataType.text()) |
|
2511 | 2337 | |
|
2512 | 2338 | dpath = str(self.proDataPath.text()) |
|
2513 | 2339 | |
|
2514 | 2340 | if dpath == '': |
|
2515 | 2341 | outputstr = 'Datapath is empty' |
|
2516 | 2342 | self.console.append(outputstr) |
|
2517 | 2343 | parms_ok = False |
|
2518 | 2344 | dpath = None |
|
2519 | 2345 | |
|
2520 | 2346 | if dpath != None: |
|
2521 | 2347 | if not os.path.isdir(dpath): |
|
2522 | 2348 | outputstr = 'Datapath (%s) does not exist' % dpath |
|
2523 | 2349 | self.console.append(outputstr) |
|
2524 | 2350 | parms_ok = False |
|
2525 | 2351 | dpath = None |
|
2526 | 2352 | |
|
2527 | 2353 | online = int(self.proComReadMode.currentIndex()) |
|
2528 | 2354 | |
|
2529 | 2355 | delay = None |
|
2530 | 2356 | if online==1: |
|
2531 | 2357 | try: |
|
2532 | 2358 | delay = int(str(self.proDelay.text())) |
|
2533 | 2359 | except: |
|
2534 | 2360 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proDelay.text()) |
|
2535 | 2361 | self.console.append(outputstr) |
|
2536 | 2362 | parms_ok = False |
|
2537 | 2363 | |
|
2538 | 2364 | |
|
2539 | 2365 | set = None |
|
2540 | 2366 | value = str(self.proSet.text()) |
|
2541 | 2367 | try: |
|
2542 | 2368 | set = int(value) |
|
2543 | 2369 | except: |
|
2544 | 2370 | pass |
|
2545 | 2371 | |
|
2546 | 2372 | ippKm = None |
|
2547 | 2373 | |
|
2548 | 2374 | value = str(self.proIPPKm.text()) |
|
2549 | 2375 | |
|
2550 | 2376 | try: |
|
2551 | 2377 | ippKm = float(value) |
|
2552 | 2378 | except: |
|
2553 | 2379 | if datatype=="USRP": |
|
2554 | 2380 | outputstr = 'IPP value (%s) must be a float number' % str(self.proIPPKm.text()) |
|
2555 | 2381 | self.console.append(outputstr) |
|
2556 | 2382 | parms_ok = False |
|
2557 | 2383 | |
|
2558 | 2384 | walk = int(self.proComWalk.currentIndex()) |
|
2559 | 2385 | |
|
2560 | 2386 | startDate = str(self.proComStartDate.currentText()) |
|
2561 | 2387 | endDate = str(self.proComEndDate.currentText()) |
|
2562 | 2388 | |
|
2563 | 2389 | # startDateList = startDate.split("/") |
|
2564 | 2390 | # endDateList = endDate.split("/") |
|
2565 | 2391 | # |
|
2566 | 2392 | # startDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) |
|
2567 | 2393 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) |
|
2568 | 2394 | |
|
2569 | 2395 | startTime = self.proStartTime.time() |
|
2570 | 2396 | endTime = self.proEndTime.time() |
|
2571 | 2397 | |
|
2572 | 2398 | startTime = str(startTime.toString("H:m:s")) |
|
2573 | 2399 | endTime = str(endTime.toString("H:m:s")) |
|
2574 | 2400 | |
|
2575 | 2401 | projectParms = ProjectParms() |
|
2576 | 2402 | |
|
2577 | 2403 | projectParms.name = project_name |
|
2578 | 2404 | projectParms.description = description |
|
2579 | 2405 | projectParms.datatype = datatype |
|
2580 | 2406 | projectParms.ext = ext |
|
2581 | 2407 | projectParms.dpath = dpath |
|
2582 | 2408 | projectParms.online = online |
|
2583 | 2409 | projectParms.startDate = startDate |
|
2584 | 2410 | projectParms.endDate = endDate |
|
2585 | 2411 | projectParms.startTime = startTime |
|
2586 | 2412 | projectParms.endTime = endTime |
|
2587 | 2413 | projectParms.delay=delay |
|
2588 | 2414 | projectParms.walk=walk |
|
2589 | 2415 | projectParms.set=set |
|
2590 | 2416 | projectParms.ippKm=ippKm |
|
2591 | 2417 | projectParms.parmsOk=parms_ok |
|
2592 | 2418 | |
|
2593 | 2419 | return projectParms |
|
2594 | 2420 | |
|
2595 | 2421 | |
|
2596 | 2422 | def __getParmsFromProjectObj(self, projectObjView): |
|
2597 | 2423 | |
|
2598 | 2424 | parms_ok = True |
|
2599 | 2425 | |
|
2600 | 2426 | project_name, description = projectObjView.name, projectObjView.description |
|
2601 | 2427 | |
|
2602 | 2428 | readUnitObj = projectObjView.getReadUnitObj() |
|
2603 | 2429 | datatype = readUnitObj.datatype |
|
2604 | 2430 | |
|
2605 | 2431 | operationObj = readUnitObj.getOperationObj(name='run') |
|
2606 | 2432 | |
|
2607 | 2433 | dpath = operationObj.getParameterValue(parameterName='path') |
|
2608 | 2434 | startDate = operationObj.getParameterValue(parameterName='startDate') |
|
2609 | 2435 | endDate = operationObj.getParameterValue(parameterName='endDate') |
|
2610 | 2436 | |
|
2611 | 2437 | startDate = startDate.strftime("%Y/%m/%d") |
|
2612 | 2438 | endDate = endDate.strftime("%Y/%m/%d") |
|
2613 | 2439 | |
|
2614 | 2440 | startTime = operationObj.getParameterValue(parameterName='startTime') |
|
2615 | 2441 | endTime = operationObj.getParameterValue(parameterName='endTime') |
|
2616 | 2442 | |
|
2617 | 2443 | startTime = startTime.strftime("%H:%M:%S") |
|
2618 | 2444 | endTime = endTime.strftime("%H:%M:%S") |
|
2619 | 2445 | |
|
2620 | 2446 | online = 0 |
|
2621 | 2447 | try: |
|
2622 | 2448 | online = operationObj.getParameterValue(parameterName='online') |
|
2623 | 2449 | except: |
|
2624 | 2450 | pass |
|
2625 | 2451 | |
|
2626 | 2452 | delay = '' |
|
2627 | 2453 | try: |
|
2628 | 2454 | delay = operationObj.getParameterValue(parameterName='delay') |
|
2629 | 2455 | except: |
|
2630 | 2456 | pass |
|
2631 | 2457 | |
|
2632 | 2458 | walk = 0 |
|
2633 | 2459 | try: |
|
2634 | 2460 | walk = operationObj.getParameterValue(parameterName='walk') |
|
2635 | 2461 | except: |
|
2636 | 2462 | pass |
|
2637 | 2463 | |
|
2638 | 2464 | set = '' |
|
2639 | 2465 | try: |
|
2640 | 2466 | set = operationObj.getParameterValue(parameterName='set') |
|
2641 | 2467 | except: |
|
2642 | 2468 | pass |
|
2643 | 2469 | |
|
2644 | 2470 | ippKm = '' |
|
2645 | 2471 | if datatype.lower() == 'usrp': |
|
2646 | 2472 | try: |
|
2647 | 2473 | ippKm = operationObj.getParameterValue(parameterName='ippKm') |
|
2648 | 2474 | except: |
|
2649 | 2475 | pass |
|
2650 | 2476 | |
|
2651 | 2477 | projectParms = ProjectParms() |
|
2652 | 2478 | |
|
2653 | 2479 | projectParms.name = project_name |
|
2654 | 2480 | projectParms.description = description |
|
2655 | 2481 | projectParms.datatype = datatype |
|
2656 | 2482 | projectParms.ext = None |
|
2657 | 2483 | projectParms.dpath = dpath |
|
2658 | 2484 | projectParms.online = online |
|
2659 | 2485 | projectParms.startDate = startDate |
|
2660 | 2486 | projectParms.endDate = endDate |
|
2661 | 2487 | projectParms.startTime = startTime |
|
2662 | 2488 | projectParms.endTime = endTime |
|
2663 | 2489 | projectParms.delay=delay |
|
2664 | 2490 | projectParms.walk=walk |
|
2665 | 2491 | projectParms.set=set |
|
2666 | 2492 | projectParms.ippKm=ippKm |
|
2667 | 2493 | projectParms.parmsOk=parms_ok |
|
2668 | 2494 | |
|
2669 | 2495 | return projectParms |
|
2670 | 2496 | |
|
2671 | 2497 | def refreshProjectWindow2(self, projectObjView): |
|
2672 | 2498 | |
|
2673 | 2499 | projectParms = self.__getParmsFromProjectObj(projectObjView) |
|
2674 | 2500 | |
|
2675 | 2501 | index = projectParms.getDatatypeIndex() |
|
2676 | 2502 | |
|
2677 | 2503 | self.proName.setText(projectParms.name) |
|
2678 | 2504 | self.proDescription.clear() |
|
2679 | 2505 | self.proDescription.append(projectParms.description) |
|
2680 | 2506 | |
|
2681 | 2507 | self.on_proComDataType_activated(index=index) |
|
2682 | 2508 | self.proDataPath.setText(projectParms.dpath) |
|
2683 | 2509 | self.proComDataType.setCurrentIndex(index) |
|
2684 | 2510 | self.proComReadMode.setCurrentIndex(projectParms.online) |
|
2685 | 2511 | self.proDelay.setText(str(projectParms.delay)) |
|
2686 | 2512 | self.proSet.setText(str(projectParms.set)) |
|
2687 | 2513 | self.proIPPKm.setText(str(projectParms.ippKm)) |
|
2688 | 2514 | |
|
2689 | 2515 | dateList = self.loadDays(data_path = projectParms.dpath, |
|
2690 | 2516 | ext = projectParms.getExt(), |
|
2691 | 2517 | walk = projectParms.walk, |
|
2692 | 2518 | expLabel = projectParms.expLabel) |
|
2693 | 2519 | |
|
2694 | 2520 | try: |
|
2695 | 2521 | startDateIndex = dateList.index(projectParms.startDate) |
|
2696 | 2522 | except: |
|
2697 | 2523 | startDateIndex = 0 |
|
2698 | 2524 | |
|
2699 | 2525 | try: |
|
2700 | 2526 | endDateIndex = dateList.index(projectParms.endDate) |
|
2701 | 2527 | except: |
|
2702 | 2528 | endDateIndex = int(self.proComEndDate.count()-1) |
|
2703 | 2529 | |
|
2704 | 2530 | self.proComStartDate.setCurrentIndex(startDateIndex) |
|
2705 | 2531 | self.proComEndDate.setCurrentIndex(endDateIndex) |
|
2706 | 2532 | |
|
2707 | 2533 | startlist = projectParms.startTime.split(":") |
|
2708 | 2534 | endlist = projectParms.endTime.split(":") |
|
2709 | 2535 | |
|
2710 | 2536 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) |
|
2711 | 2537 | self.proStartTime.setTime(self.time) |
|
2712 | 2538 | |
|
2713 | 2539 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
2714 | 2540 | self.proEndTime.setTime(self.time) |
|
2715 | 2541 | |
|
2716 | 2542 | |
|
2717 | 2543 | def __refreshVoltageWindow(self, puObj): |
|
2718 | 2544 | |
|
2719 | 2545 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
2720 | 2546 | if opObj == None: |
|
2721 | 2547 | self.volOpRadarfrequency.clear() |
|
2722 | 2548 | self.volOpCebRadarfrequency.setCheckState(0) |
|
2723 | 2549 | else: |
|
2724 | 2550 | value = opObj.getParameterValue(parameterName='frequency') |
|
2725 | 2551 | value = str(value) |
|
2726 | 2552 | self.volOpRadarfrequency.setText(value) |
|
2727 | 2553 | self.volOpRadarfrequency.setEnabled(True) |
|
2728 | 2554 | self.volOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
2729 | 2555 | |
|
2730 | 2556 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2731 | 2557 | |
|
2732 | 2558 | if opObj == None: |
|
2733 | 2559 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
2734 | 2560 | |
|
2735 | 2561 | if opObj == None: |
|
2736 | 2562 | self.volOpChannel.clear() |
|
2737 | 2563 | self.volOpCebChannels.setCheckState(0) |
|
2738 | 2564 | else: |
|
2739 | 2565 | channelEnabled = False |
|
2740 | 2566 | try: |
|
2741 | 2567 | value = opObj.getParameterValue(parameterName='channelList') |
|
2742 | 2568 | value = str(value)[1:-1] |
|
2743 | 2569 | channelEnabled = True |
|
2744 | 2570 | channelMode = 0 |
|
2745 | 2571 | except: |
|
2746 | 2572 | pass |
|
2747 | 2573 | try: |
|
2748 | 2574 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
2749 | 2575 | value = str(value)[1:-1] |
|
2750 | 2576 | channelEnabled = True |
|
2751 | 2577 | channelMode = 1 |
|
2752 | 2578 | except: |
|
2753 | 2579 | pass |
|
2754 | 2580 | |
|
2755 | 2581 | if channelEnabled: |
|
2756 | 2582 | self.volOpChannel.setText(value) |
|
2757 | 2583 | self.volOpChannel.setEnabled(True) |
|
2758 | 2584 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) |
|
2759 | 2585 | self.volOpComChannels.setCurrentIndex(channelMode) |
|
2760 | 2586 | |
|
2761 | 2587 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2762 | 2588 | if opObj == None: |
|
2763 | 2589 | self.volOpHeights.clear() |
|
2764 | 2590 | self.volOpCebHeights.setCheckState(0) |
|
2765 | 2591 | else: |
|
2766 | 2592 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
2767 | 2593 | value1 = str(value1) |
|
2768 | 2594 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
2769 | 2595 | value2 = str(value2) |
|
2770 | 2596 | value = value1 + "," + value2 |
|
2771 | 2597 | self.volOpHeights.setText(value) |
|
2772 | 2598 | self.volOpHeights.setEnabled(True) |
|
2773 | 2599 | self.volOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
2774 | 2600 | |
|
2775 | 2601 | opObj = puObj.getOperationObj(name="filterByHeights") |
|
2776 | 2602 | if opObj == None: |
|
2777 | 2603 | self.volOpFilter.clear() |
|
2778 | 2604 | self.volOpCebFilter.setCheckState(0) |
|
2779 | 2605 | else: |
|
2780 | 2606 | value = opObj.getParameterValue(parameterName='window') |
|
2781 | 2607 | value = str(value) |
|
2782 | 2608 | self.volOpFilter.setText(value) |
|
2783 | 2609 | self.volOpFilter.setEnabled(True) |
|
2784 | 2610 | self.volOpCebFilter.setCheckState(QtCore.Qt.Checked) |
|
2785 | 2611 | |
|
2786 | 2612 | opObj = puObj.getOperationObj(name="ProfileSelector") |
|
2787 | 2613 | if opObj == None: |
|
2788 | 2614 | self.volOpProfile.clear() |
|
2789 | 2615 | self.volOpCebProfile.setCheckState(0) |
|
2790 | 2616 | else: |
|
2791 | 2617 | for parmObj in opObj.getParameterObjList(): |
|
2792 | 2618 | |
|
2793 | 2619 | if parmObj.name == "profileList": |
|
2794 | 2620 | value = parmObj.getValue() |
|
2795 | 2621 | value = str(value)[1:-1] |
|
2796 | 2622 | self.volOpProfile.setText(value) |
|
2797 | 2623 | self.volOpProfile.setEnabled(True) |
|
2798 | 2624 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2799 | 2625 | self.volOpComProfile.setCurrentIndex(0) |
|
2800 | 2626 | |
|
2801 | 2627 | if parmObj.name == "profileRangeList": |
|
2802 | 2628 | value = parmObj.getValue() |
|
2803 | 2629 | value = str(value)[1:-1] |
|
2804 | 2630 | self.volOpProfile.setText(value) |
|
2805 | 2631 | self.volOpProfile.setEnabled(True) |
|
2806 | 2632 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2807 | 2633 | self.volOpComProfile.setCurrentIndex(1) |
|
2808 | 2634 | |
|
2809 | 2635 | if parmObj.name == "rangeList": |
|
2810 | 2636 | value = parmObj.getValue() |
|
2811 | 2637 | value = str(value)[1:-1] |
|
2812 | 2638 | self.volOpProfile.setText(value) |
|
2813 | 2639 | self.volOpProfile.setEnabled(True) |
|
2814 | 2640 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2815 | 2641 | self.volOpComProfile.setCurrentIndex(2) |
|
2816 | 2642 | |
|
2817 | 2643 | opObj = puObj.getOperationObj(name="Decoder") |
|
2818 | 2644 | self.volOpCode.setText("") |
|
2819 | 2645 | if opObj == None: |
|
2820 | 2646 | self.volOpCebDecodification.setCheckState(0) |
|
2821 | 2647 | else: |
|
2822 | 2648 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) |
|
2823 | 2649 | |
|
2824 | 2650 | parmObj = opObj.getParameterObj('code') |
|
2825 | 2651 | |
|
2826 | 2652 | if parmObj == None: |
|
2827 | 2653 | self.volOpComCode.setCurrentIndex(0) |
|
2828 | 2654 | else: |
|
2829 | 2655 | |
|
2830 | 2656 | parmObj1 = opObj.getParameterObj('nCode') |
|
2831 | 2657 | parmObj2 = opObj.getParameterObj('nBaud') |
|
2832 | 2658 | |
|
2833 | 2659 | if parmObj1 == None or parmObj2 == None: |
|
2834 | 2660 | self.volOpComCode.setCurrentIndex(0) |
|
2835 | 2661 | else: |
|
2836 | 2662 | code = ast.literal_eval(str(parmObj.getValue())) |
|
2837 | 2663 | nCode = parmObj1.getValue() |
|
2838 | 2664 | nBaud = parmObj2.getValue() |
|
2839 | 2665 | |
|
2840 | 2666 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
2841 | 2667 | |
|
2842 | 2668 | #User defined by default |
|
2843 | 2669 | self.volOpComCode.setCurrentIndex(13) |
|
2844 | 2670 | self.volOpCode.setText(str(code)) |
|
2845 | 2671 | |
|
2846 | 2672 | if nCode == 1: |
|
2847 | 2673 | if nBaud == 3: |
|
2848 | 2674 | self.volOpComCode.setCurrentIndex(1) |
|
2849 | 2675 | if nBaud == 4: |
|
2850 | 2676 | self.volOpComCode.setCurrentIndex(2) |
|
2851 | 2677 | if nBaud == 5: |
|
2852 | 2678 | self.volOpComCode.setCurrentIndex(3) |
|
2853 | 2679 | if nBaud == 7: |
|
2854 | 2680 | self.volOpComCode.setCurrentIndex(4) |
|
2855 | 2681 | if nBaud == 11: |
|
2856 | 2682 | self.volOpComCode.setCurrentIndex(5) |
|
2857 | 2683 | if nBaud == 13: |
|
2858 | 2684 | self.volOpComCode.setCurrentIndex(6) |
|
2859 | 2685 | |
|
2860 | 2686 | if nCode == 2: |
|
2861 | 2687 | if nBaud == 3: |
|
2862 | 2688 | self.volOpComCode.setCurrentIndex(7) |
|
2863 | 2689 | if nBaud == 4: |
|
2864 | 2690 | self.volOpComCode.setCurrentIndex(8) |
|
2865 | 2691 | if nBaud == 5: |
|
2866 | 2692 | self.volOpComCode.setCurrentIndex(9) |
|
2867 | 2693 | if nBaud == 7: |
|
2868 | 2694 | self.volOpComCode.setCurrentIndex(10) |
|
2869 | 2695 | if nBaud == 11: |
|
2870 | 2696 | self.volOpComCode.setCurrentIndex(11) |
|
2871 | 2697 | if nBaud == 13: |
|
2872 | 2698 | self.volOpComCode.setCurrentIndex(12) |
|
2873 | 2699 | |
|
2874 | 2700 | |
|
2875 | 2701 | opObj = puObj.getOperationObj(name="deFlip") |
|
2876 | 2702 | if opObj == None: |
|
2877 | 2703 | self.volOpFlip.clear() |
|
2878 | 2704 | self.volOpFlip.setEnabled(False) |
|
2879 | 2705 | self.volOpCebFlip.setCheckState(0) |
|
2880 | 2706 | else: |
|
2881 | 2707 | try: |
|
2882 | 2708 | value = opObj.getParameterValue(parameterName='channelList') |
|
2883 | 2709 | value = str(value)[1:-1] |
|
2884 | 2710 | except: |
|
2885 | 2711 | value = "" |
|
2886 | 2712 | |
|
2887 | 2713 | self.volOpFlip.setText(value) |
|
2888 | 2714 | self.volOpFlip.setEnabled(True) |
|
2889 | 2715 | self.volOpCebFlip.setCheckState(QtCore.Qt.Checked) |
|
2890 | 2716 | |
|
2891 | 2717 | opObj = puObj.getOperationObj(name="CohInt") |
|
2892 | 2718 | if opObj == None: |
|
2893 | 2719 | self.volOpCohInt.clear() |
|
2894 | 2720 | self.volOpCebCohInt.setCheckState(0) |
|
2895 | 2721 | else: |
|
2896 | 2722 | value = opObj.getParameterValue(parameterName='n') |
|
2897 | 2723 | self.volOpCohInt.setText(str(value)) |
|
2898 | 2724 | self.volOpCohInt.setEnabled(True) |
|
2899 | 2725 | self.volOpCebCohInt.setCheckState(QtCore.Qt.Checked) |
|
2900 | 2726 | |
|
2901 | 2727 | opObj = puObj.getOperationObj(name='Scope') |
|
2902 | 2728 | if opObj == None: |
|
2903 | 2729 | self.volGraphCebshow.setCheckState(0) |
|
2904 | 2730 | else: |
|
2905 | 2731 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) |
|
2906 | 2732 | |
|
2907 | 2733 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
2908 | 2734 | |
|
2909 | 2735 | if parmObj == None: |
|
2910 | 2736 | self.volGraphChannelList.clear() |
|
2911 | 2737 | else: |
|
2912 | 2738 | value = parmObj.getValue() |
|
2913 | 2739 | value = str(value) |
|
2914 | 2740 | self.volGraphChannelList.setText(value) |
|
2915 | 2741 | self.volOpProfile.setEnabled(True) |
|
2916 | 2742 | |
|
2917 | 2743 | parmObj1 = opObj.getParameterObj(parameterName='xmin') |
|
2918 | 2744 | parmObj2 = opObj.getParameterObj(parameterName='xmax') |
|
2919 | 2745 | |
|
2920 | 2746 | if parmObj1 == None or parmObj2 ==None: |
|
2921 | 2747 | self.volGraphfreqrange.clear() |
|
2922 | 2748 | else: |
|
2923 | 2749 | value1 = parmObj1.getValue() |
|
2924 | 2750 | value1 = str(value1) |
|
2925 | 2751 | value2 = parmObj2.getValue() |
|
2926 | 2752 | value2 = str(value2) |
|
2927 | 2753 | value = value1 + "," + value2 |
|
2928 | 2754 | self.volGraphfreqrange.setText(value) |
|
2929 | 2755 | |
|
2930 | 2756 | parmObj1 = opObj.getParameterObj(parameterName='ymin') |
|
2931 | 2757 | parmObj2 = opObj.getParameterObj(parameterName='ymax') |
|
2932 | 2758 | |
|
2933 | 2759 | if parmObj1 == None or parmObj2 ==None: |
|
2934 | 2760 | self.volGraphHeightrange.clear() |
|
2935 | 2761 | else: |
|
2936 | 2762 | value1 = parmObj1.getValue() |
|
2937 | 2763 | value1 = str(value1) |
|
2938 | 2764 | value2 = parmObj2.getValue() |
|
2939 | 2765 | value2 = str(value2) |
|
2940 | 2766 | value = value1 + "," + value2 |
|
2941 | 2767 | value2 = str(value2) |
|
2942 | 2768 | self.volGraphHeightrange.setText(value) |
|
2943 | 2769 | |
|
2944 | 2770 | parmObj = opObj.getParameterObj(parameterName='save') |
|
2945 | 2771 | |
|
2946 | 2772 | if parmObj == None: |
|
2947 | 2773 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2948 | 2774 | else: |
|
2949 | 2775 | value = parmObj.getValue() |
|
2950 | 2776 | if int(value): |
|
2951 | 2777 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) |
|
2952 | 2778 | else: |
|
2953 | 2779 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2954 | 2780 | |
|
2955 | 2781 | parmObj = opObj.getParameterObj(parameterName='figpath') |
|
2956 | 2782 | if parmObj == None: |
|
2957 | 2783 | self.volGraphPath.clear() |
|
2958 | 2784 | else: |
|
2959 | 2785 | value = parmObj.getValue() |
|
2960 | 2786 | path = str(value) |
|
2961 | 2787 | self.volGraphPath.setText(path) |
|
2962 | 2788 | |
|
2963 | 2789 | parmObj = opObj.getParameterObj(parameterName='figfile') |
|
2964 | 2790 | if parmObj == None: |
|
2965 | 2791 | self.volGraphPrefix.clear() |
|
2966 | 2792 | else: |
|
2967 | 2793 | value = parmObj.getValue() |
|
2968 | 2794 | figfile = str(value) |
|
2969 | 2795 | self.volGraphPrefix.setText(figfile) |
|
2970 | 2796 | |
|
2971 | 2797 | # outputVoltageWrite |
|
2972 | 2798 | opObj = puObj.getOperationObj(name='VoltageWriter') |
|
2973 | 2799 | |
|
2974 | 2800 | if opObj == None: |
|
2975 | 2801 | self.volOutputPath.clear() |
|
2976 | 2802 | self.volOutputblocksperfile.clear() |
|
2977 | 2803 | self.volOutputprofilesperblock.clear() |
|
2978 | 2804 | else: |
|
2979 | 2805 | parmObj = opObj.getParameterObj(parameterName='path') |
|
2980 | 2806 | if parmObj == None: |
|
2981 | 2807 | self.volOutputPath.clear() |
|
2982 | 2808 | else: |
|
2983 | 2809 | value = parmObj.getValue() |
|
2984 | 2810 | path = str(value) |
|
2985 | 2811 | self.volOutputPath.setText(path) |
|
2986 | 2812 | |
|
2987 | 2813 | parmObj = opObj.getParameterObj(parameterName='blocksPerFile') |
|
2988 | 2814 | if parmObj == None: |
|
2989 | 2815 | self.volOutputblocksperfile.clear() |
|
2990 | 2816 | else: |
|
2991 | 2817 | value = parmObj.getValue() |
|
2992 | 2818 | blocksperfile = str(value) |
|
2993 | 2819 | self.volOutputblocksperfile.setText(blocksperfile) |
|
2994 | 2820 | |
|
2995 | 2821 | parmObj = opObj.getParameterObj(parameterName='profilesPerBlock') |
|
2996 | 2822 | if parmObj == None: |
|
2997 | 2823 | self.volOutputprofilesperblock.clear() |
|
2998 | 2824 | else: |
|
2999 | 2825 | value = parmObj.getValue() |
|
3000 | 2826 | profilesPerBlock = str(value) |
|
3001 | 2827 | self.volOutputprofilesperblock.setText(profilesPerBlock) |
|
3002 | 2828 | |
|
3003 | 2829 | return |
|
3004 | 2830 | |
|
3005 | 2831 | def __refreshSpectraWindow(self, puObj): |
|
3006 | ||
|
2832 | ||
|
2833 | inputId = puObj.getInputId() | |
|
2834 | inputPUObj = self.__puObjDict[inputId] | |
|
2835 | ||
|
2836 | if inputPUObj.datatype == 'Voltage': | |
|
2837 | self.specOpnFFTpoints.setEnabled(True) | |
|
2838 | self.specOpProfiles.setEnabled(True) | |
|
2839 | self.specOpippFactor.setEnabled(True) | |
|
2840 | else: | |
|
2841 | self.specOpnFFTpoints.setEnabled(False) | |
|
2842 | self.specOpProfiles.setEnabled(False) | |
|
2843 | self.specOpippFactor.setEnabled(False) | |
|
2844 | ||
|
3007 | 2845 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
3008 | 2846 | if opObj == None: |
|
3009 | 2847 | self.specOpRadarfrequency.clear() |
|
3010 | 2848 | self.specOpCebRadarfrequency.setCheckState(0) |
|
3011 | 2849 | else: |
|
3012 | 2850 | value = opObj.getParameterValue(parameterName='frequency') |
|
3013 | 2851 | value = str(value) |
|
3014 | 2852 | self.specOpRadarfrequency.setText(value) |
|
3015 | 2853 | self.specOpRadarfrequency.setEnabled(True) |
|
3016 | 2854 | self.specOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
3017 | 2855 | |
|
3018 | 2856 | opObj = puObj.getOperationObj(name="run") |
|
3019 | 2857 | if opObj == None: |
|
3020 | 2858 | self.specOpnFFTpoints.clear() |
|
3021 | 2859 | self.specOpProfiles.clear() |
|
3022 | 2860 | self.specOpippFactor.clear() |
|
3023 | 2861 | else: |
|
3024 | 2862 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') |
|
3025 | 2863 | if parmObj == None: |
|
3026 | 2864 | self.specOpnFFTpoints.clear() |
|
3027 | 2865 | else: |
|
3028 | 2866 | self.specOpnFFTpoints.setEnabled(True) |
|
3029 | 2867 | value = opObj.getParameterValue(parameterName='nFFTPoints') |
|
3030 | 2868 | self.specOpnFFTpoints.setText(str(value)) |
|
3031 | 2869 | |
|
3032 | 2870 | parmObj = opObj.getParameterObj(parameterName='nProfiles') |
|
3033 | 2871 | if parmObj == None: |
|
3034 | 2872 | self.specOpProfiles.clear() |
|
3035 | 2873 | else: |
|
3036 | 2874 | self.specOpProfiles.setEnabled(True) |
|
3037 | 2875 | value = opObj.getParameterValue(parameterName='nProfiles') |
|
3038 | 2876 | self.specOpProfiles.setText(str(value)) |
|
3039 | 2877 | |
|
3040 | 2878 | parmObj = opObj.getParameterObj(parameterName='ippFactor') |
|
3041 | 2879 | if parmObj == None: |
|
3042 | 2880 | self.specOpippFactor.clear() |
|
3043 | 2881 | else: |
|
3044 | 2882 | self.specOpippFactor.setEnabled(True) |
|
3045 | 2883 | value = opObj.getParameterValue(parameterName='ippFactor') |
|
3046 | 2884 | self.specOpippFactor.setText(str(value)) |
|
3047 | 2885 | |
|
3048 | 2886 | opObj = puObj.getOperationObj(name="run") |
|
3049 | 2887 | if opObj == None: |
|
3050 | 2888 | self.specOppairsList.clear() |
|
3051 | 2889 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3052 | 2890 | else: |
|
3053 | 2891 | parmObj = opObj.getParameterObj(parameterName='pairsList') |
|
3054 | 2892 | if parmObj == None: |
|
3055 | 2893 | self.specOppairsList.clear() |
|
3056 | 2894 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3057 | 2895 | else: |
|
3058 | 2896 | value = opObj.getParameterValue(parameterName='pairsList') |
|
3059 | 2897 | value = str(value)[1:-1] |
|
3060 | 2898 | self.specOppairsList.setText(str(value)) |
|
3061 | 2899 | self.specOppairsList.setEnabled(True) |
|
3062 | 2900 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) |
|
3063 | 2901 | |
|
3064 | 2902 | opObj = puObj.getOperationObj(name="selectChannels") |
|
3065 | 2903 | |
|
3066 | 2904 | if opObj == None: |
|
3067 | 2905 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
3068 | 2906 | |
|
3069 | 2907 | if opObj == None: |
|
3070 | 2908 | self.specOpChannel.clear() |
|
3071 | 2909 | self.specOpCebChannel.setCheckState(0) |
|
3072 | 2910 | else: |
|
3073 | 2911 | channelEnabled = False |
|
3074 | 2912 | try: |
|
3075 | 2913 | value = opObj.getParameterValue(parameterName='channelList') |
|
3076 | 2914 | value = str(value)[1:-1] |
|
3077 | 2915 | channelEnabled = True |
|
3078 | 2916 | channelMode = 0 |
|
3079 | 2917 | except: |
|
3080 | 2918 | pass |
|
3081 | 2919 | try: |
|
3082 | 2920 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
3083 | 2921 | value = str(value)[1:-1] |
|
3084 | 2922 | channelEnabled = True |
|
3085 | 2923 | channelMode = 1 |
|
3086 | 2924 | except: |
|
3087 | 2925 | pass |
|
3088 | 2926 | |
|
3089 | 2927 | if channelEnabled: |
|
3090 | 2928 | self.specOpChannel.setText(value) |
|
3091 | 2929 | self.specOpChannel.setEnabled(True) |
|
3092 | 2930 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) |
|
3093 | 2931 | self.specOpComChannel.setCurrentIndex(channelMode) |
|
3094 | 2932 | |
|
3095 | 2933 | opObj = puObj.getOperationObj(name="selectHeights") |
|
3096 | 2934 | if opObj == None: |
|
3097 | 2935 | self.specOpHeights.clear() |
|
3098 | 2936 | self.specOpCebHeights.setCheckState(0) |
|
3099 | 2937 | else: |
|
3100 | 2938 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
3101 | 2939 | value1 = str(value1) |
|
3102 | 2940 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
3103 | 2941 | value2 = str(value2) |
|
3104 | 2942 | value = value1 + "," + value2 |
|
3105 | 2943 | self.specOpHeights.setText(value) |
|
3106 | 2944 | self.specOpHeights.setEnabled(True) |
|
3107 | 2945 | self.specOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
3108 | 2946 | |
|
3109 | 2947 | opObj = puObj.getOperationObj(name="IncohInt") |
|
3110 | 2948 | if opObj == None: |
|
3111 | 2949 | self.specOpIncoherent.clear() |
|
3112 | 2950 | self.specOpCebIncoherent.setCheckState(0) |
|
3113 | 2951 | else: |
|
3114 | 2952 | for parmObj in opObj.getParameterObjList(): |
|
3115 | 2953 | if parmObj.name == 'timeInterval': |
|
3116 | 2954 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3117 | 2955 | value = float(value) |
|
3118 | 2956 | self.specOpIncoherent.setText(str(value)) |
|
3119 | 2957 | self.specOpIncoherent.setEnabled(True) |
|
3120 | 2958 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3121 | 2959 | self.specOpCobIncInt.setCurrentIndex(0) |
|
3122 | 2960 | |
|
3123 | 2961 | if parmObj.name == 'n': |
|
3124 | 2962 | value = opObj.getParameterValue(parameterName='n') |
|
3125 | 2963 | value = float(value) |
|
3126 | 2964 | self.specOpIncoherent.setText(str(value)) |
|
3127 | 2965 | self.specOpIncoherent.setEnabled(True) |
|
3128 | 2966 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3129 | 2967 | self.specOpCobIncInt.setCurrentIndex(1) |
|
3130 | 2968 | |
|
3131 | 2969 | opObj = puObj.getOperationObj(name="removeDC") |
|
3132 | 2970 | if opObj == None: |
|
3133 | 2971 | self.specOpCebRemoveDC.setCheckState(0) |
|
3134 | 2972 | else: |
|
3135 | 2973 | self.specOpCebRemoveDC.setCheckState(QtCore.Qt.Checked) |
|
3136 | 2974 | value = opObj.getParameterValue(parameterName='mode') |
|
3137 | 2975 | if value == 1: |
|
3138 | 2976 | self.specOpComRemoveDC.setCurrentIndex(0) |
|
3139 | 2977 | elif value == 2: |
|
3140 | 2978 | self.specOpComRemoveDC.setCurrentIndex(1) |
|
3141 | 2979 | |
|
3142 | 2980 | opObj = puObj.getOperationObj(name="removeInterference") |
|
3143 | 2981 | if opObj == None: |
|
3144 | 2982 | self.specOpCebRemoveInt.setCheckState(0) |
|
3145 | 2983 | else: |
|
3146 | 2984 | self.specOpCebRemoveInt.setCheckState(QtCore.Qt.Checked) |
|
3147 | 2985 | |
|
3148 | 2986 | opObj = puObj.getOperationObj(name='getNoise') |
|
3149 | 2987 | if opObj == None: |
|
3150 | 2988 | self.specOpCebgetNoise.setCheckState(0) |
|
3151 | 2989 | self.specOpgetNoise.clear() |
|
3152 | 2990 | else: |
|
3153 | 2991 | self.specOpCebgetNoise.setCheckState(QtCore.Qt.Checked) |
|
3154 | 2992 | parmObj = opObj.getParameterObj(parameterName='minHei') |
|
3155 | 2993 | if parmObj == None: |
|
3156 | 2994 | self.specOpgetNoise.clear() |
|
3157 | 2995 | value1 = None |
|
3158 | 2996 | else: |
|
3159 |
|
|
|
3160 |
|
|
|
3161 |
|
|
|
2997 | value1 = opObj.getParameterValue(parameterName='minHei') | |
|
2998 | value1 = str(value1) | |
|
2999 | parmObj = opObj.getParameterObj(parameterName='maxHei') | |
|
3000 | if parmObj == None: | |
|
3001 | value2 = None | |
|
3002 | value = value1 | |
|
3003 | self.specOpgetNoise.setText(value) | |
|
3004 | self.specOpgetNoise.setEnabled(True) | |
|
3005 | else: | |
|
3006 | value2 = opObj.getParameterValue(parameterName='maxHei') | |
|
3007 | value2 = str(value2) | |
|
3008 | parmObj = opObj.getParameterObj(parameterName='minVel') | |
|
3162 | 3009 | if parmObj == None: |
|
3163 |
value |
|
|
3164 | value = value1 | |
|
3010 | value3 = None | |
|
3011 | value = value1 + "," + value2 | |
|
3165 | 3012 | self.specOpgetNoise.setText(value) |
|
3166 | 3013 | self.specOpgetNoise.setEnabled(True) |
|
3167 | 3014 | else: |
|
3168 |
value |
|
|
3169 |
value |
|
|
3170 |
parmObj = opObj.getParameterObj(parameterName='m |
|
|
3015 | value3 = opObj.getParameterValue(parameterName='minVel') | |
|
3016 | value3 = str(value3) | |
|
3017 | parmObj = opObj.getParameterObj(parameterName='maxVel') | |
|
3171 | 3018 | if parmObj == None: |
|
3172 |
value |
|
|
3173 | value = value1 + "," + value2 | |
|
3019 | value4 = None | |
|
3020 | value = value1 + "," + value2 + "," + value3 | |
|
3174 | 3021 | self.specOpgetNoise.setText(value) |
|
3175 | 3022 | self.specOpgetNoise.setEnabled(True) |
|
3176 | 3023 | else: |
|
3177 |
value |
|
|
3178 |
value |
|
|
3179 | parmObj = opObj.getParameterObj(parameterName='maxVel') | |
|
3180 |
|
|
|
3181 | value4 = None | |
|
3182 | value = value1 + "," + value2 + "," + value3 | |
|
3183 | self.specOpgetNoise.setText(value) | |
|
3184 | self.specOpgetNoise.setEnabled(True) | |
|
3185 | else: | |
|
3186 | value4 = opObj.getParameterValue(parameterName='maxVel') | |
|
3187 | value4 = str(value4) | |
|
3188 | value = value1 + "," + value2 + "," + value3 + ',' + value4 | |
|
3189 | self.specOpgetNoise.setText(value) | |
|
3190 | self.specOpgetNoise.setEnabled(True) | |
|
3024 | value4 = opObj.getParameterValue(parameterName='maxVel') | |
|
3025 | value4 = str(value4) | |
|
3026 | value = value1 + "," + value2 + "," + value3 + ',' + value4 | |
|
3027 | self.specOpgetNoise.setText(value) | |
|
3028 | self.specOpgetNoise.setEnabled(True) | |
|
3191 | 3029 | |
|
3192 | 3030 | opObj = puObj.getOperationObj(name='SpectraPlot') |
|
3193 | # opObj = puObj.getOpObjfromParamValue(value="SpectraPlot") | |
|
3031 | ||
|
3194 | 3032 | if opObj == None: |
|
3195 | 3033 | self.specGraphCebSpectraplot.setCheckState(0) |
|
3196 | 3034 | self.specGraphSaveSpectra.setCheckState(0) |
|
3197 | 3035 | self.specGraphftpSpectra.setCheckState(0) |
|
3198 | ||
|
3199 | 3036 | else: |
|
3200 | 3037 | operationSpectraPlot = "Enable" |
|
3201 | 3038 | self.specGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3202 | 3039 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3203 | 3040 | if parmObj == None: |
|
3204 |
|
|
|
3041 | self.specGgraphChannelList.clear() | |
|
3205 | 3042 | else: |
|
3206 | 3043 | value = opObj.getParameterValue(parameterName='channelList') |
|
3207 | 3044 | channelListSpectraPlot = str(value)[1:-1] |
|
3208 | 3045 | self.specGgraphChannelList.setText(channelListSpectraPlot) |
|
3209 | 3046 | self.specGgraphChannelList.setEnabled(True) |
|
3210 | 3047 | |
|
3211 | 3048 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3212 | 3049 | if parmObj == None: |
|
3213 | 3050 | self.specGgraphFreq.clear() |
|
3214 | 3051 | else: |
|
3215 |
|
|
|
3216 |
|
|
|
3217 |
|
|
|
3218 |
|
|
|
3219 |
|
|
|
3220 |
|
|
|
3221 |
|
|
|
3052 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
3053 | value1 = str(value1) | |
|
3054 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
3055 | value2 = str(value2) | |
|
3056 | value = value1 + "," + value2 | |
|
3057 | self.specGgraphFreq.setText(value) | |
|
3058 | self.specGgraphFreq.setEnabled(True) | |
|
3222 | 3059 | |
|
3223 | 3060 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3224 | 3061 | if parmObj == None: |
|
3225 | 3062 | self.specGgraphHeight.clear() |
|
3226 | 3063 | else: |
|
3227 |
|
|
|
3228 |
|
|
|
3229 |
|
|
|
3230 |
|
|
|
3231 |
|
|
|
3232 |
|
|
|
3233 |
|
|
|
3064 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
3065 | value1 = str(value1) | |
|
3066 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
3067 | value2 = str(value2) | |
|
3068 | value = value1 + "," + value2 | |
|
3069 | self.specGgraphHeight.setText(value) | |
|
3070 | self.specGgraphHeight.setEnabled(True) | |
|
3234 | 3071 | |
|
3235 | 3072 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3236 | 3073 | if parmObj == None: |
|
3237 | 3074 | self.specGgraphDbsrange.clear() |
|
3238 | 3075 | else: |
|
3239 |
|
|
|
3240 |
|
|
|
3241 |
|
|
|
3242 |
|
|
|
3243 |
|
|
|
3244 |
|
|
|
3245 |
|
|
|
3076 | value1 = opObj.getParameterValue(parameterName='zmin') | |
|
3077 | value1 = str(value1) | |
|
3078 | value2 = opObj.getParameterValue(parameterName='zmax') | |
|
3079 | value2 = str(value2) | |
|
3080 | value = value1 + "," + value2 | |
|
3081 | self.specGgraphDbsrange.setText(value) | |
|
3082 | self.specGgraphDbsrange.setEnabled(True) | |
|
3246 | 3083 | |
|
3247 | 3084 | |
|
3248 | 3085 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3249 | 3086 | if parmObj == None: |
|
3250 |
|
|
|
3087 | self.specGraphSaveSpectra.setCheckState(0) | |
|
3251 | 3088 | else: |
|
3252 |
|
|
|
3253 |
|
|
|
3254 |
|
|
|
3089 | self.specGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) | |
|
3090 | value = opObj.getParameterValue(parameterName='figpath') | |
|
3091 | self.specGraphPath.setText(value) | |
|
3255 | 3092 | |
|
3256 | 3093 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3257 | 3094 | if parmObj == None: |
|
3258 |
|
|
|
3095 | self.specGraphftpSpectra.setCheckState(0) | |
|
3259 | 3096 | else: |
|
3260 |
|
|
|
3261 |
|
|
|
3262 |
|
|
|
3263 |
|
|
|
3264 |
|
|
|
3265 |
|
|
|
3097 | self.specGraphftpSpectra.setCheckState(QtCore.Qt.Checked) | |
|
3098 | try: | |
|
3099 | value = opObj.getParameterValue(parameterName='wr_period') | |
|
3100 | except: | |
|
3101 | value = " " | |
|
3102 | self.specGgraphftpratio.setText(str(value)) | |
|
3266 | 3103 | |
|
3267 |
opObj = puObj.getOperationObj(name='CrossSpectraPlot') |
|
|
3268 | # opObj = puObj.getOpObjfromParamValue(value="CrossSpectraPlot") | |
|
3104 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') | |
|
3105 | ||
|
3269 | 3106 | if opObj == None: |
|
3270 | 3107 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
3271 | 3108 | self.specGraphSaveCross.setCheckState(0) |
|
3272 | ||
|
3109 | self.specGraphftpCross.setCheckState(0) | |
|
3273 | 3110 | else: |
|
3274 | 3111 | operationCrossSpectraPlot = "Enable" |
|
3275 | 3112 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3276 | 3113 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3277 | 3114 | if parmObj == None: |
|
3278 | 3115 | self.specGgraphFreq.clear() |
|
3279 | 3116 | else: |
|
3280 |
|
|
|
3281 |
|
|
|
3282 |
|
|
|
3283 |
|
|
|
3284 |
|
|
|
3285 |
|
|
|
3286 |
|
|
|
3117 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
3118 | value1 = str(value1) | |
|
3119 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
3120 | value2 = str(value2) | |
|
3121 | value = value1 + "," + value2 | |
|
3122 | self.specGgraphFreq.setText(value) | |
|
3123 | self.specGgraphFreq.setEnabled(True) | |
|
3287 | 3124 | |
|
3288 | 3125 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3289 | 3126 | if parmObj == None: |
|
3290 | 3127 | self.specGgraphHeight.clear() |
|
3291 | 3128 | else: |
|
3292 |
|
|
|
3293 |
|
|
|
3294 |
|
|
|
3295 |
|
|
|
3296 |
|
|
|
3297 |
|
|
|
3298 |
|
|
|
3129 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
3130 | value1 = str(value1) | |
|
3131 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
3132 | value2 = str(value2) | |
|
3133 | value = value1 + "," + value2 | |
|
3134 | self.specGgraphHeight.setText(value) | |
|
3135 | self.specGgraphHeight.setEnabled(True) | |
|
3299 | 3136 | |
|
3300 | 3137 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3301 | 3138 | if parmObj == None: |
|
3302 | 3139 | self.specGgraphDbsrange.clear() |
|
3303 | 3140 | else: |
|
3304 |
|
|
|
3305 |
|
|
|
3306 |
|
|
|
3307 |
|
|
|
3308 |
|
|
|
3309 |
|
|
|
3310 |
|
|
|
3311 | ||
|
3141 | value1 = opObj.getParameterValue(parameterName='zmin') | |
|
3142 | value1 = str(value1) | |
|
3143 | value2 = opObj.getParameterValue(parameterName='zmax') | |
|
3144 | value2 = str(value2) | |
|
3145 | value = value1 + "," + value2 | |
|
3146 | self.specGgraphDbsrange.setText(value) | |
|
3147 | self.specGgraphDbsrange.setEnabled(True) | |
|
3148 | ||
|
3149 | parmObj = opObj.getParameterObj(parameterName='coh_min') | |
|
3150 | if parmObj == None: | |
|
3151 | self.specGgraphmagnitud.clear() | |
|
3152 | else: | |
|
3153 | value1 = opObj.getParameterValue(parameterName='coh_min') | |
|
3154 | value1 = str(value1) | |
|
3155 | value2 = opObj.getParameterValue(parameterName='coh_max') | |
|
3156 | value2 = str(value2) | |
|
3157 | value = value1 + "," + value2 | |
|
3158 | self.specGgraphmagnitud.setText(value) | |
|
3159 | self.specGgraphmagnitud.setEnabled(True) | |
|
3160 | ||
|
3161 | parmObj = opObj.getParameterObj(parameterName='phase_min') | |
|
3162 | if parmObj == None: | |
|
3163 | self.specGgraphPhase.clear() | |
|
3164 | else: | |
|
3165 | value1 = opObj.getParameterValue(parameterName='phase_min') | |
|
3166 | value1 = str(value1) | |
|
3167 | value2 = opObj.getParameterValue(parameterName='phase_max') | |
|
3168 | value2 = str(value2) | |
|
3169 | value = value1 + "," + value2 | |
|
3170 | self.specGgraphPhase.setText(value) | |
|
3171 | self.specGgraphPhase.setEnabled(True) | |
|
3172 | ||
|
3312 | 3173 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3313 | 3174 | if parmObj == None: |
|
3314 | 3175 | self.specGraphSaveCross.setCheckState(0) |
|
3315 | 3176 | |
|
3316 | 3177 | else: |
|
3317 |
|
|
|
3318 |
|
|
|
3319 |
|
|
|
3178 | self.specGraphSaveCross.setCheckState(QtCore.Qt.Checked) | |
|
3179 | value = opObj.getParameterValue(parameterName='figpath') | |
|
3180 | self.specGraphPath.setText(value) | |
|
3320 | 3181 | |
|
3321 | 3182 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3322 | 3183 | if parmObj == None: |
|
3323 |
|
|
|
3184 | self.specGraphftpCross.setCheckState(0) | |
|
3324 | 3185 | else: |
|
3325 |
|
|
|
3326 |
|
|
|
3327 |
|
|
|
3328 |
|
|
|
3329 |
|
|
|
3330 |
|
|
|
3186 | self.specGraphftpCross.setCheckState(QtCore.Qt.Checked) | |
|
3187 | try: | |
|
3188 | value = opObj.getParameterValue(parameterName='wr_period') | |
|
3189 | except: | |
|
3190 | value = " " | |
|
3191 | self.specGgraphftpratio.setText(str(value)) | |
|
3331 | 3192 | |
|
3332 | 3193 | opObj = puObj.getOperationObj(name='RTIPlot') |
|
3333 | 3194 | # opObj = puObj.getOpObjfromParamValue(value="RTIPlot") |
|
3334 | 3195 | if opObj == None: |
|
3335 | 3196 | self.specGraphCebRTIplot.setCheckState(0) |
|
3336 | 3197 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3337 | 3198 | self.specGraphftpRTIplot.setCheckState(0) |
|
3338 | 3199 | else: |
|
3339 | 3200 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3340 | 3201 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3341 | 3202 | if parmObj == None: |
|
3342 | 3203 | self.specGgraphChannelList.clear() |
|
3343 | 3204 | else: |
|
3344 | 3205 | value = opObj.getParameterValue(parameterName='channelList') |
|
3345 | 3206 | channelListRTIPlot = str(value)[1:-1] |
|
3346 | 3207 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3347 | 3208 | self.specGgraphChannelList.setEnabled(True) |
|
3348 | 3209 | |
|
3349 | 3210 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3350 | 3211 | if parmObj == None: |
|
3351 | 3212 | self.specGgraphTminTmax.clear() |
|
3352 | 3213 | else: |
|
3353 | 3214 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3354 | 3215 | value1 = str(value1) |
|
3355 | 3216 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3356 | 3217 | value2 = str(value2) |
|
3357 | 3218 | value = value1 + "," + value2 |
|
3358 | 3219 | self.specGgraphTminTmax.setText(value) |
|
3359 | 3220 | self.specGgraphTminTmax.setEnabled(True) |
|
3360 | 3221 | |
|
3361 | 3222 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3362 | 3223 | if parmObj == None: |
|
3363 | 3224 | self.specGgraphTimeRange.clear() |
|
3364 | 3225 | else: |
|
3365 | 3226 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3366 | 3227 | value1 = str(value1) |
|
3367 | 3228 | self.specGgraphTimeRange.setText(value1) |
|
3368 | 3229 | self.specGgraphTimeRange.setEnabled(True) |
|
3369 | 3230 | |
|
3370 | 3231 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3371 | 3232 | if parmObj == None: |
|
3372 | 3233 | self.specGgraphHeight.clear() |
|
3373 | 3234 | else: |
|
3374 | 3235 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3375 | 3236 | value1 = str(value1) |
|
3376 | 3237 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3377 | 3238 | value2 = str(value2) |
|
3378 | 3239 | value = value1 + "," + value2 |
|
3379 | 3240 | self.specGgraphHeight.setText(value) |
|
3380 | 3241 | self.specGgraphHeight.setEnabled(True) |
|
3381 | 3242 | |
|
3382 | 3243 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3383 | 3244 | if parmObj == None: |
|
3384 | 3245 | self.specGgraphDbsrange.clear() |
|
3385 | 3246 | else: |
|
3386 | 3247 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3387 | 3248 | value1 = str(value1) |
|
3388 | 3249 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3389 | 3250 | value2 = str(value2) |
|
3390 | 3251 | value = value1 + "," + value2 |
|
3391 | 3252 | self.specGgraphDbsrange.setText(value) |
|
3392 | 3253 | self.specGgraphDbsrange.setEnabled(True) |
|
3393 | 3254 | |
|
3394 | 3255 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3395 | 3256 | if parmObj == None: |
|
3396 | 3257 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3397 | 3258 | else: |
|
3398 |
|
|
|
3399 |
|
|
|
3400 |
|
|
|
3259 | self.specGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) | |
|
3260 | value = opObj.getParameterValue(parameterName='figpath') | |
|
3261 | self.specGraphPath.setText(value) | |
|
3401 | 3262 | |
|
3402 | 3263 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3403 | 3264 | if parmObj == None: |
|
3404 | 3265 | self.specGraphftpRTIplot.setCheckState(0) |
|
3405 | 3266 | else: |
|
3406 |
|
|
|
3407 |
|
|
|
3408 |
|
|
|
3409 |
|
|
|
3410 |
|
|
|
3411 |
|
|
|
3267 | self.specGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) | |
|
3268 | try: | |
|
3269 | value = opObj.getParameterValue(parameterName='wr_period') | |
|
3270 | except: | |
|
3271 | value = " " | |
|
3272 | self.specGgraphftpratio.setText(str(value)) | |
|
3412 | 3273 | |
|
3413 | 3274 | opObj = puObj.getOperationObj(name='CoherenceMap') |
|
3414 | 3275 | # opObj = puObj.getOpObjfromParamValue(value="CoherenceMap") |
|
3415 | 3276 | if opObj == None: |
|
3416 | 3277 | self.specGraphCebCoherencmap.setCheckState(0) |
|
3417 | 3278 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3418 | 3279 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3419 | ||
|
3420 | 3280 | else: |
|
3421 | 3281 | operationCoherenceMap = "Enable" |
|
3422 | 3282 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) |
|
3423 | 3283 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3424 | 3284 | if parmObj == None: |
|
3425 | 3285 | self.specGgraphTminTmax.clear() |
|
3426 | 3286 | else: |
|
3427 |
|
|
|
3428 |
|
|
|
3429 |
|
|
|
3430 |
|
|
|
3431 |
|
|
|
3432 |
|
|
|
3433 |
|
|
|
3287 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
3288 | value1 = str(value1) | |
|
3289 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
3290 | value2 = str(value2) | |
|
3291 | value = value1 + "," + value2 | |
|
3292 | self.specGgraphTminTmax.setText(value) | |
|
3293 | self.specGgraphTminTmax.setEnabled(True) | |
|
3434 | 3294 | |
|
3435 | 3295 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3436 | 3296 | if parmObj == None: |
|
3437 | 3297 | self.specGgraphTimeRange.clear() |
|
3438 | 3298 | else: |
|
3439 |
|
|
|
3440 |
|
|
|
3441 |
|
|
|
3442 |
|
|
|
3299 | value1 = opObj.getParameterValue(parameterName='timerange') | |
|
3300 | value1 = str(value1) | |
|
3301 | self.specGgraphTimeRange.setText(value1) | |
|
3302 | self.specGgraphTimeRange.setEnabled(True) | |
|
3443 | 3303 | |
|
3444 | 3304 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3445 | 3305 | if parmObj == None: |
|
3446 | 3306 | self.specGgraphHeight.clear() |
|
3447 | 3307 | else: |
|
3448 |
|
|
|
3449 |
|
|
|
3450 |
|
|
|
3451 |
|
|
|
3452 |
|
|
|
3453 |
|
|
|
3454 |
|
|
|
3308 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
3309 | value1 = str(value1) | |
|
3310 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
3311 | value2 = str(value2) | |
|
3312 | value = value1 + "," + value2 | |
|
3313 | self.specGgraphHeight.setText(value) | |
|
3314 | self.specGgraphHeight.setEnabled(True) | |
|
3455 | 3315 | |
|
3456 | 3316 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3457 | 3317 | if parmObj == None: |
|
3458 | 3318 | self.specGgraphmagnitud.clear() |
|
3459 | 3319 | else: |
|
3460 |
|
|
|
3461 |
|
|
|
3462 |
|
|
|
3463 |
|
|
|
3464 |
|
|
|
3465 |
|
|
|
3466 |
|
|
|
3467 | ||
|
3320 | value1 = opObj.getParameterValue(parameterName='zmin') | |
|
3321 | value1 = str(value1) | |
|
3322 | value2 = opObj.getParameterValue(parameterName='zmax') | |
|
3323 | value2 = str(value2) | |
|
3324 | value = value1 + "," + value2 | |
|
3325 | self.specGgraphmagnitud.setText(value) | |
|
3326 | self.specGgraphmagnitud.setEnabled(True) | |
|
3327 | ||
|
3328 | parmObj = opObj.getParameterObj(parameterName='coh_min') | |
|
3329 | if parmObj == None: | |
|
3330 | self.specGgraphmagnitud.clear() | |
|
3331 | else: | |
|
3332 | value1 = opObj.getParameterValue(parameterName='coh_min') | |
|
3333 | value1 = str(value1) | |
|
3334 | value2 = opObj.getParameterValue(parameterName='coh_max') | |
|
3335 | value2 = str(value2) | |
|
3336 | value = value1 + "," + value2 | |
|
3337 | self.specGgraphmagnitud.setText(value) | |
|
3338 | self.specGgraphmagnitud.setEnabled(True) | |
|
3339 | ||
|
3340 | parmObj = opObj.getParameterObj(parameterName='phase_min') | |
|
3341 | if parmObj == None: | |
|
3342 | self.specGgraphPhase.clear() | |
|
3343 | else: | |
|
3344 | value1 = opObj.getParameterValue(parameterName='phase_min') | |
|
3345 | value1 = str(value1) | |
|
3346 | value2 = opObj.getParameterValue(parameterName='phase_max') | |
|
3347 | value2 = str(value2) | |
|
3348 | value = value1 + "," + value2 | |
|
3349 | self.specGgraphPhase.setText(value) | |
|
3350 | self.specGgraphPhase.setEnabled(True) | |
|
3351 | ||
|
3468 | 3352 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3469 | 3353 | if parmObj == None: |
|
3470 | 3354 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3471 | 3355 | else: |
|
3472 |
|
|
|
3473 |
|
|
|
3474 |
|
|
|
3356 | self.specGraphSaveCoherencemap.setCheckState(QtCore.Qt.Checked) | |
|
3357 | value = opObj.getParameterValue(parameterName='figpath') | |
|
3358 | self.specGraphPath.setText(value) | |
|
3475 | 3359 | |
|
3476 | 3360 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3477 | 3361 | if parmObj == None: |
|
3478 | 3362 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3479 | 3363 | else: |
|
3480 |
|
|
|
3481 |
|
|
|
3482 |
|
|
|
3483 |
|
|
|
3484 |
|
|
|
3485 |
|
|
|
3364 | self.specGraphftpCoherencemap.setCheckState(QtCore.Qt.Checked) | |
|
3365 | try: | |
|
3366 | value = opObj.getParameterValue(parameterName='wr_period') | |
|
3367 | except: | |
|
3368 | value = " " | |
|
3369 | self.specGgraphftpratio.setText(str(value)) | |
|
3486 | 3370 | |
|
3487 | 3371 | opObj = puObj.getOperationObj(name='PowerProfilePlot') |
|
3488 | 3372 | # opObj = puObj.getOpObjfromParamValue(value="PowerProfilePlot") |
|
3489 | 3373 | if opObj == None: |
|
3490 | 3374 | self.specGraphPowerprofile.setCheckState(0) |
|
3491 | 3375 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3376 | self.specGraphftpPowerprofile.setCheckState(0) | |
|
3492 | 3377 | operationPowerProfilePlot = "Disabled" |
|
3493 | 3378 | channelList = None |
|
3494 | 3379 | freq_vel = None |
|
3495 | 3380 | heightsrange = None |
|
3496 | 3381 | else: |
|
3497 | 3382 | operationPowerProfilePlot = "Enable" |
|
3498 | 3383 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3499 | 3384 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3500 | 3385 | if parmObj == None: |
|
3501 | 3386 | self.specGgraphDbsrange.clear() |
|
3502 | 3387 | else: |
|
3503 | 3388 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3504 | 3389 | value1 = str(value1) |
|
3505 | 3390 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3506 | 3391 | value2 = str(value2) |
|
3507 | 3392 | value = value1 + "," + value2 |
|
3508 | 3393 | self.specGgraphDbsrange.setText(value) |
|
3509 | 3394 | self.specGgraphDbsrange.setEnabled(True) |
|
3510 | 3395 | |
|
3511 | 3396 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3512 | 3397 | if parmObj == None: |
|
3513 | 3398 | self.specGgraphHeight.clear() |
|
3514 | 3399 | else: |
|
3515 | 3400 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3516 | 3401 | value1 = str(value1) |
|
3517 | 3402 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3518 | 3403 | value2 = str(value2) |
|
3519 | 3404 | value = value1 + "," + value2 |
|
3520 | 3405 | self.specGgraphHeight.setText(value) |
|
3521 | 3406 | self.specGgraphHeight.setEnabled(True) |
|
3522 | 3407 | |
|
3523 | 3408 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3524 | 3409 | if parmObj == None: |
|
3525 | 3410 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3526 | 3411 | else: |
|
3527 | 3412 | self.specGraphSavePowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3528 | 3413 | value = opObj.getParameterValue(parameterName='figpath') |
|
3529 | 3414 | self.specGraphPath.setText(value) |
|
3530 | 3415 | |
|
3531 | 3416 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3532 | 3417 | if parmObj == None: |
|
3533 | 3418 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3534 | 3419 | else: |
|
3535 | 3420 | self.specGraphftpPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3536 | 3421 | try: |
|
3537 | 3422 | value = opObj.getParameterValue(parameterName='wr_period') |
|
3538 | 3423 | except: |
|
3539 | 3424 | value = " " |
|
3540 | 3425 | self.specGgraphftpratio.setText(str(value)) |
|
3541 | 3426 | # -noise |
|
3542 | 3427 | opObj = puObj.getOperationObj(name='Noise') |
|
3543 | 3428 | # opObj = puObj.getOpObjfromParamValue(value="Noise") |
|
3544 | 3429 | if opObj == None: |
|
3545 | 3430 | self.specGraphCebRTInoise.setCheckState(0) |
|
3546 | 3431 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3547 | 3432 | self.specGraphftpRTInoise.setCheckState(0) |
|
3548 | 3433 | else: |
|
3549 | 3434 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3550 | 3435 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3551 | 3436 | if parmObj == None: |
|
3552 | 3437 | self.specGgraphChannelList.clear() |
|
3553 | 3438 | else: |
|
3554 | 3439 | value = opObj.getParameterValue(parameterName='channelList') |
|
3555 | 3440 | channelListRTINoise = str(value)[1:-1] |
|
3556 | 3441 | self.specGgraphChannelList.setText(channelListRTINoise) |
|
3557 | 3442 | self.specGgraphChannelList.setEnabled(True) |
|
3558 | 3443 | |
|
3559 | 3444 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3560 | 3445 | if parmObj == None: |
|
3561 | 3446 | self.specGgraphTminTmax.clear() |
|
3562 | 3447 | else: |
|
3563 | 3448 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3564 | 3449 | value1 = str(value1) |
|
3565 | 3450 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3566 | 3451 | value2 = str(value2) |
|
3567 | 3452 | value = value1 + "," + value2 |
|
3568 | 3453 | self.specGgraphTminTmax.setText(value) |
|
3569 | 3454 | self.specGgraphTminTmax.setEnabled(True) |
|
3570 | 3455 | |
|
3571 | 3456 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3572 | 3457 | if parmObj == None: |
|
3573 | 3458 | self.specGgraphTimeRange.clear() |
|
3574 | 3459 | else: |
|
3575 | 3460 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3576 | 3461 | value1 = str(value1) |
|
3577 | 3462 | self.specGgraphTimeRange.setText(value1) |
|
3578 | 3463 | self.specGgraphTimeRange.setEnabled(True) |
|
3579 | 3464 | |
|
3580 | 3465 | |
|
3581 | 3466 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3582 | 3467 | if parmObj == None: |
|
3583 | 3468 | self.specGgraphDbsrange.clear() |
|
3584 | 3469 | else: |
|
3585 | 3470 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3586 | 3471 | value1 = str(value1) |
|
3587 | 3472 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3588 | 3473 | value2 = str(value2) |
|
3589 | 3474 | value = value1 + "," + value2 |
|
3590 | 3475 | self.specGgraphDbsrange.setText(value) |
|
3591 | 3476 | self.specGgraphDbsrange.setEnabled(True) |
|
3592 | 3477 | |
|
3593 | 3478 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3594 | 3479 | if parmObj == None: |
|
3595 | 3480 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3596 | 3481 | else: |
|
3597 | 3482 | self.specGraphSaveRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3598 | 3483 | value = opObj.getParameterValue(parameterName='figpath') |
|
3599 | 3484 | self.specGraphPath.setText(value) |
|
3600 | 3485 | |
|
3601 | 3486 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3602 | 3487 | if parmObj == None: |
|
3603 | 3488 | self.specGraphftpRTInoise.setCheckState(0) |
|
3604 | 3489 | else: |
|
3605 | 3490 | self.specGraphftpRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3606 | 3491 | try: |
|
3607 | 3492 | value = opObj.getParameterValue(parameterName='wr_period') |
|
3608 | 3493 | except: |
|
3609 | 3494 | value = " " |
|
3610 | 3495 | self.specGgraphftpratio.setText(str(value)) |
|
3611 | 3496 | |
|
3612 | 3497 | # outputSpectraWrite |
|
3613 | 3498 | opObj = puObj.getOperationObj(name='SpectraWriter') |
|
3614 | 3499 | if opObj == None: |
|
3615 | 3500 | self.specOutputPath.clear() |
|
3616 | 3501 | self.specOutputblocksperfile.clear() |
|
3617 | 3502 | self.specOutputprofileperblock.clear() |
|
3618 | 3503 | else: |
|
3619 | 3504 | value = opObj.getParameterObj(parameterName='path') |
|
3620 | 3505 | if value == None: |
|
3621 | 3506 | self.specOutputPath.clear() |
|
3622 | 3507 | else: |
|
3623 | 3508 | value = opObj.getParameterValue(parameterName='path') |
|
3624 | 3509 | path = str(value) |
|
3625 | 3510 | self.specOutputPath.setText(path) |
|
3626 | 3511 | value = opObj.getParameterObj(parameterName='blocksPerFile') |
|
3627 | 3512 | if value == None: |
|
3628 | 3513 | self.specOutputblocksperfile.clear() |
|
3629 | 3514 | else: |
|
3630 | 3515 | value = opObj.getParameterValue(parameterName='blocksPerFile') |
|
3631 | 3516 | blocksperfile = str(value) |
|
3632 | 3517 | self.specOutputblocksperfile.setText(blocksperfile) |
|
3633 | 3518 | value = opObj.getParameterObj(parameterName='profilesPerBlock') |
|
3634 | 3519 | if value == None: |
|
3635 | 3520 | self.specOutputprofileperblock.clear() |
|
3636 | 3521 | else: |
|
3637 | 3522 | value = opObj.getParameterValue(parameterName='profilesPerBlock') |
|
3638 | 3523 | profilesPerBlock = str(value) |
|
3639 | 3524 | self.specOutputprofileperblock.setText(profilesPerBlock) |
|
3640 | 3525 | |
|
3641 | 3526 | return |
|
3642 | 3527 | |
|
3643 | 3528 | def __refreshSpectraHeisWindow(self, puObj): |
|
3644 | 3529 | |
|
3645 | 3530 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") |
|
3646 | 3531 | if opObj == None: |
|
3647 | 3532 | self.specHeisOpIncoherent.clear() |
|
3648 | 3533 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
3649 | 3534 | else: |
|
3650 | 3535 | for parmObj in opObj.getParameterObjList(): |
|
3651 | 3536 | if parmObj.name == 'timeInterval': |
|
3652 | 3537 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3653 | 3538 | value = float(value) |
|
3654 | 3539 | self.specHeisOpIncoherent.setText(str(value)) |
|
3655 | 3540 | self.specHeisOpIncoherent.setEnabled(True) |
|
3656 | 3541 | self.specHeisOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3657 | 3542 | self.specHeisOpCobIncInt.setCurrentIndex(0) |
|
3658 | 3543 | |
|
3659 | 3544 | # SpectraHeis Graph |
|
3660 | 3545 | opObj = puObj.getOperationObj(name='SpectraHeisScope') |
|
3661 | 3546 | # opObj = puObj.getOpObjfromParamValue(value="SpectraHeisScope") |
|
3662 | 3547 | if opObj == None: |
|
3663 | 3548 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
3664 | 3549 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3665 | 3550 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3666 | 3551 | |
|
3667 | 3552 | else: |
|
3668 | 3553 | operationSpectraHeisScope = "Enable" |
|
3669 | 3554 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3670 | 3555 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3671 | 3556 | if parmObj == None: |
|
3672 | 3557 | self.specHeisGgraphChannelList.clear() |
|
3673 | 3558 | else: |
|
3674 | 3559 | value = opObj.getParameterValue(parameterName='channelList') |
|
3675 | 3560 | channelListSpectraHeisScope = str(value)[1:-1] |
|
3676 | 3561 | self.specHeisGgraphChannelList.setText(channelListSpectraHeisScope) |
|
3677 | 3562 | self.specHeisGgraphChannelList.setEnabled(True) |
|
3678 | 3563 | |
|
3679 | 3564 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3680 | 3565 | if parmObj == None: |
|
3681 | 3566 | self.specHeisGgraphXminXmax.clear() |
|
3682 | 3567 | else: |
|
3683 | 3568 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3684 | 3569 | value1 = str(value1) |
|
3685 | 3570 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3686 | 3571 | value2 = str(value2) |
|
3687 | 3572 | value = value1 + "," + value2 |
|
3688 | 3573 | self.specHeisGgraphXminXmax.setText(value) |
|
3689 | 3574 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
3690 | 3575 | |
|
3691 | 3576 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3692 | 3577 | if parmObj == None: |
|
3693 | 3578 | self.specHeisGgraphYminYmax.clear() |
|
3694 | 3579 | else: |
|
3695 | 3580 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3696 | 3581 | value1 = str(value1) |
|
3697 | 3582 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3698 | 3583 | value2 = str(value2) |
|
3699 | 3584 | value = value1 + "," + value2 |
|
3700 | 3585 | self.specHeisGgraphYminYmax.setText(value) |
|
3701 | 3586 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3702 | 3587 | |
|
3703 | 3588 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3704 | 3589 | if parmObj == None: |
|
3705 | 3590 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3706 | 3591 | else: |
|
3707 | 3592 | self.specHeisGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3708 | 3593 | value = opObj.getParameterValue(parameterName='figpath') |
|
3709 | 3594 | self.specHeisGraphPath.setText(value) |
|
3710 | 3595 | |
|
3711 | 3596 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3712 | 3597 | if parmObj == None: |
|
3713 | 3598 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3714 | 3599 | else: |
|
3715 | 3600 | self.specHeisGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3716 | 3601 | try: |
|
3717 | 3602 | value = opObj.getParameterValue(parameterName='wr_period') |
|
3718 | 3603 | except: |
|
3719 | 3604 | value = " " |
|
3720 | 3605 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3721 | 3606 | |
|
3722 | 3607 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') |
|
3723 | 3608 | # opObj = puObj.getOpObjfromParamValue(value="RTIfromSpectraHeis") |
|
3724 | 3609 | if opObj == None: |
|
3725 | 3610 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
3726 | 3611 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3727 | 3612 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3728 | 3613 | else: |
|
3729 | 3614 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3730 | 3615 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3731 | 3616 | if parmObj == None: |
|
3732 | 3617 | self.specHeisGgraphChannelList.clear() |
|
3733 | 3618 | else: |
|
3734 | 3619 | value = opObj.getParameterValue(parameterName='channelList') |
|
3735 | 3620 | channelListRTIPlot = str(value)[1:-1] |
|
3736 | 3621 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3737 | 3622 | self.specGgraphChannelList.setEnabled(True) |
|
3738 | 3623 | |
|
3739 | 3624 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3740 | 3625 | if parmObj == None: |
|
3741 | 3626 | self.specHeisGgraphTminTmax.clear() |
|
3742 | 3627 | else: |
|
3743 | 3628 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3744 | 3629 | value1 = str(value1) |
|
3745 | 3630 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3746 | 3631 | value2 = str(value2) |
|
3747 | 3632 | value = value1 + "," + value2 |
|
3748 | 3633 | self.specHeisGgraphTminTmax.setText(value) |
|
3749 | 3634 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
3750 | 3635 | |
|
3751 | 3636 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3752 | 3637 | if parmObj == None: |
|
3753 | 3638 | self.specGgraphTimeRange.clear() |
|
3754 | 3639 | else: |
|
3755 | 3640 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3756 | 3641 | value1 = str(value1) |
|
3757 | 3642 | self.specHeisGgraphTimeRange.setText(value1) |
|
3758 | 3643 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
3759 | 3644 | |
|
3760 | 3645 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3761 | 3646 | if parmObj == None: |
|
3762 | 3647 | self.specHeisGgraphYminYmax.clear() |
|
3763 | 3648 | else: |
|
3764 | 3649 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3765 | 3650 | value1 = str(value1) |
|
3766 | 3651 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3767 | 3652 | value2 = str(value2) |
|
3768 | 3653 | value = value1 + "," + value2 |
|
3769 | 3654 | self.specHeisGgraphYminYmax.setText(value) |
|
3770 | 3655 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3771 | 3656 | |
|
3772 | 3657 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3773 | 3658 | if parmObj == None: |
|
3774 | 3659 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3775 | 3660 | else: |
|
3776 | 3661 | self.specHeisGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3777 | 3662 | value = opObj.getParameterValue(parameterName='figpath') |
|
3778 | 3663 | self.specHeisGraphPath.setText(value) |
|
3779 | 3664 | |
|
3780 | 3665 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3781 | 3666 | if parmObj == None: |
|
3782 | 3667 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3783 | 3668 | else: |
|
3784 | 3669 | self.specHeisGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3785 | 3670 | try: |
|
3786 | 3671 | value = opObj.getParameterValue(parameterName='wr_period') |
|
3787 | 3672 | except: |
|
3788 | 3673 | value = " " |
|
3789 | 3674 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3790 | 3675 | |
|
3791 | 3676 | # outputSpectraHeisWrite |
|
3792 | 3677 | opObj = puObj.getOperationObj(name='FitsWriter') |
|
3793 | 3678 | if opObj == None: |
|
3794 | 3679 | self.specHeisOutputPath.clear() |
|
3795 | 3680 | self.specHeisOutputblocksperfile.clear() |
|
3796 | 3681 | self.specHeisOutputMetada.clear() |
|
3797 | 3682 | else: |
|
3798 | 3683 | value = opObj.getParameterObj(parameterName='path') |
|
3799 | 3684 | if value == None: |
|
3800 | 3685 | self.specHeisOutputPath.clear() |
|
3801 | 3686 | else: |
|
3802 | 3687 | value = opObj.getParameterValue(parameterName='path') |
|
3803 | 3688 | path = str(value) |
|
3804 | 3689 | self.specHeisOutputPath.setText(path) |
|
3805 | 3690 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') |
|
3806 | 3691 | if value == None: |
|
3807 | 3692 | self.specHeisOutputblocksperfile.clear() |
|
3808 | 3693 | else: |
|
3809 | 3694 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') |
|
3810 | 3695 | blocksperfile = str(value) |
|
3811 | 3696 | self.specHeisOutputblocksperfile.setText(blocksperfile) |
|
3812 | 3697 | value = opObj.getParameterObj(parameterName='metadatafile') |
|
3813 | 3698 | if value == None: |
|
3814 | 3699 | self.specHeisOutputMetada.clear() |
|
3815 | 3700 | else: |
|
3816 | 3701 | value = opObj.getParameterValue(parameterName='metadatafile') |
|
3817 | 3702 | metada = str(value) |
|
3818 | 3703 | self.specHeisOutputMetada.setText(metada) |
|
3819 | 3704 | |
|
3820 | 3705 | return |
|
3821 | 3706 | |
|
3822 | 3707 | def __refreshCorrelationWindow(self, puObj): |
|
3823 | 3708 | pass |
|
3824 | 3709 | |
|
3825 |
def refreshPUWindow(self, |
|
|
3710 | def refreshPUWindow(self, puObj): | |
|
3826 | 3711 | |
|
3827 | if datatype == 'Voltage': | |
|
3712 | if puObj.datatype == 'Voltage': | |
|
3828 | 3713 | self.__refreshVoltageWindow(puObj) |
|
3829 | 3714 | |
|
3830 | if datatype == 'Spectra': | |
|
3715 | if puObj.datatype == 'Spectra': | |
|
3831 | 3716 | self.__refreshSpectraWindow(puObj) |
|
3832 | 3717 | |
|
3833 | if datatype == 'SpectraHeis': | |
|
3718 | if puObj.datatype == 'SpectraHeis': | |
|
3834 | 3719 | self.__refreshSpectraHeisWindow(puObj) |
|
3835 | 3720 | |
|
3836 | 3721 | def refreshProjectProperties(self, projectObjView): |
|
3837 | 3722 | |
|
3838 | 3723 | propertyBuffObj = PropertyBuffer() |
|
3839 | 3724 | name = projectObjView.name |
|
3840 | 3725 | |
|
3841 | 3726 | propertyBuffObj.append("Properties", "Name", projectObjView.name), |
|
3842 | 3727 | propertyBuffObj.append("Properties", "Description", projectObjView.description) |
|
3843 | 3728 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) |
|
3844 | 3729 | |
|
3845 | 3730 | readUnitObj = projectObjView.getReadUnitObj() |
|
3846 | 3731 | runOperationObj = readUnitObj.getOperationObj(name='run') |
|
3847 | 3732 | |
|
3848 | 3733 | for thisParmObj in runOperationObj.getParameterObjList(): |
|
3849 | 3734 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) |
|
3850 | 3735 | |
|
3851 | 3736 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3852 | 3737 | |
|
3853 | 3738 | self.treeProjectProperties.setModel(propertiesModel) |
|
3854 | 3739 | self.treeProjectProperties.expandAll() |
|
3855 | 3740 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3856 | 3741 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3857 | 3742 | |
|
3858 | 3743 | def refreshPUProperties(self, puObjView): |
|
3859 | 3744 | |
|
3860 | 3745 | propertyBuffObj = PropertyBuffer() |
|
3861 | 3746 | |
|
3862 | 3747 | for thisOp in puObjView.getOperationObjList(): |
|
3863 | 3748 | |
|
3864 | 3749 | operationName = thisOp.name |
|
3865 | 3750 | if operationName == 'run': |
|
3866 | 3751 | operationName = 'Properties' |
|
3867 | 3752 | else: |
|
3868 | 3753 | if not thisOp.getParameterObjList(): |
|
3869 | 3754 | propertyBuffObj.append(operationName, '--', '--') |
|
3870 | 3755 | |
|
3871 | 3756 | for thisParmObj in thisOp.getParameterObjList(): |
|
3872 | 3757 | |
|
3873 | 3758 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) |
|
3874 | 3759 | |
|
3875 | 3760 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3876 | 3761 | |
|
3877 | 3762 | self.treeProjectProperties.setModel(propertiesModel) |
|
3878 | 3763 | self.treeProjectProperties.expandAll() |
|
3879 | 3764 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3880 | 3765 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3881 | 3766 | |
|
3882 | 3767 | def refreshGraphicsId(self): |
|
3883 | 3768 | |
|
3884 | 3769 | projectObj = self.getSelectedProjectObj() |
|
3885 | 3770 | |
|
3886 | 3771 | for idPU, puObj in projectObj.procUnitConfObjDict.items(): |
|
3887 | 3772 | |
|
3888 | 3773 | for opObj in puObj.getOperationObjList(): |
|
3889 | 3774 | |
|
3890 | 3775 | if opObj.name not in ('Scope', 'SpectraPlot', 'CrossSpectraPlot', 'RTIPlot', 'CoherenceMap', 'PowerProfilePlot', 'Noise', 'SpectraHeisScope', 'RTIfromSpectraHeis'): |
|
3891 | 3776 | continue |
|
3892 | 3777 | |
|
3893 | 3778 | opObj.changeParameter(name='id', value=opObj.id, format='int') |
|
3894 | ||
|
3779 | ||
|
3895 | 3780 | def on_click(self, index): |
|
3896 | 3781 | |
|
3897 | self.console.clear() | |
|
3898 | ||
|
3899 | 3782 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) |
|
3900 | 3783 | |
|
3901 | 3784 | projectObjView = self.getSelectedProjectObj() |
|
3902 | 3785 | |
|
3903 | 3786 | if not projectObjView: |
|
3904 | 3787 | return |
|
3905 | 3788 | |
|
3906 | 3789 | self.create = False |
|
3907 | 3790 | selectedObjView = self.getSelectedItemObj() |
|
3908 | 3791 | |
|
3909 | 3792 | #A project has been selected |
|
3910 | 3793 | if projectObjView == selectedObjView: |
|
3911 | 3794 | |
|
3912 | 3795 | self.refreshProjectWindow2(projectObjView) |
|
3913 | 3796 | self.refreshProjectProperties(projectObjView) |
|
3914 | 3797 | |
|
3915 | 3798 | self.tabProject.setEnabled(True) |
|
3916 | 3799 | self.tabVoltage.setEnabled(False) |
|
3917 | 3800 | self.tabSpectra.setEnabled(False) |
|
3918 | 3801 | self.tabCorrelation.setEnabled(False) |
|
3919 | 3802 | self.tabSpectraHeis.setEnabled(False) |
|
3920 | 3803 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
3921 | 3804 | |
|
3922 | 3805 | return |
|
3923 | 3806 | |
|
3924 | 3807 | #A processing unit has been selected |
|
3925 | 3808 | voltEnable = False |
|
3926 | 3809 | specEnable = False |
|
3927 | 3810 | corrEnable = False |
|
3928 | 3811 | specHeisEnable = False |
|
3929 | 3812 | tabSelected = self.tabProject |
|
3930 | 3813 | |
|
3931 | 3814 | puObj = selectedObjView |
|
3932 | inputId = puObj.getInputId() | |
|
3933 | inputPUObj = projectObjView.getProcUnitObj(inputId) | |
|
3934 | 3815 | |
|
3935 | 3816 | if self.selectedItemTree.text() == 'Voltage': |
|
3936 | datatype = 'Voltage' | |
|
3937 | self.refreshPUWindow(datatype=datatype, puObj=puObj) | |
|
3938 | self.refreshPUProperties(puObj) | |
|
3939 | ||
|
3940 | 3817 | voltEnable = True |
|
3941 | 3818 | tabSelected = self.tabVoltage |
|
3942 | 3819 | |
|
3943 | 3820 | if self.selectedItemTree.text() == 'Spectra': |
|
3944 | ||
|
3945 | datatype = 'Spectra' | |
|
3946 | ||
|
3947 | if inputPUObj.datatype == 'Spectra': | |
|
3948 | self.specOpnFFTpoints.setEnabled(False) | |
|
3949 | self.specOpProfiles.setEnabled(False) | |
|
3950 | self.specOpippFactor.setEnabled(False) | |
|
3951 | else: | |
|
3952 | self.specOpnFFTpoints.setEnabled(True) | |
|
3953 | self.specOpProfiles.setEnabled(True) | |
|
3954 | self.specOpippFactor.setEnabled(True) | |
|
3955 | ||
|
3956 | self.refreshPUWindow(datatype=datatype, puObj=puObj) | |
|
3957 | self.refreshPUProperties(puObj) | |
|
3958 | ||
|
3959 | 3821 | specEnable = True |
|
3960 | 3822 | tabSelected = self.tabSpectra |
|
3961 | 3823 | |
|
3962 | 3824 | if self.selectedItemTree.text() == 'Correlation': |
|
3963 | ||
|
3964 | 3825 | corrEnable = True |
|
3965 | 3826 | tabSelected = self.tabCorrelation |
|
3966 | 3827 | |
|
3967 | 3828 | if self.selectedItemTree.text() == 'SpectraHeis': |
|
3968 | datatype = 'SpectraHeis' | |
|
3969 | ||
|
3970 | self.refreshPUWindow(datatype=datatype, puObj=puObj) | |
|
3971 | self.refreshPUProperties(puObj) | |
|
3972 | ||
|
3973 | specHeisEnable = False | |
|
3829 | specHeisEnable = True | |
|
3974 | 3830 | tabSelected = self.tabSpectraHeis |
|
3975 | ||
|
3831 | ||
|
3832 | self.refreshPUWindow(puObj=puObj) | |
|
3833 | self.refreshPUProperties(puObj) | |
|
3834 | ||
|
3976 | 3835 | self.tabProject.setEnabled(False) |
|
3977 | 3836 | self.tabVoltage.setEnabled(voltEnable) |
|
3978 | 3837 | self.tabSpectra.setEnabled(specEnable) |
|
3979 | 3838 | self.tabCorrelation.setEnabled(corrEnable) |
|
3980 | 3839 | self.tabSpectraHeis.setEnabled(specHeisEnable) |
|
3981 | 3840 | self.tabWidgetProject.setCurrentWidget(tabSelected) |
|
3982 | 3841 | |
|
3983 | 3842 | def on_right_click(self, pos): |
|
3984 | 3843 | |
|
3985 | 3844 | self.menu = QtGui.QMenu() |
|
3986 | 3845 | quitAction0 = self.menu.addAction("Create a New Project") |
|
3987 | 3846 | quitAction1 = self.menu.addAction("Create a New Processing Unit") |
|
3988 | 3847 | quitAction2 = self.menu.addAction("Delete Item") |
|
3989 | 3848 | quitAction3 = self.menu.addAction("Quit") |
|
3990 | 3849 | |
|
3991 | 3850 | if len(self.__itemTreeDict) == 0: |
|
3992 | 3851 | quitAction2.setEnabled(False) |
|
3993 | 3852 | else: |
|
3994 | 3853 | quitAction2.setEnabled(True) |
|
3995 | 3854 | |
|
3996 | 3855 | action = self.menu.exec_(self.mapToGlobal(pos)) |
|
3997 | 3856 | |
|
3998 | 3857 | if action == quitAction0: |
|
3999 | 3858 | self. setInputsProject_View() |
|
4000 | 3859 | self.create = True |
|
4001 | 3860 | |
|
4002 | 3861 | if action == quitAction1: |
|
4003 | 3862 | if len(self.__projectObjDict) == 0: |
|
4004 | 3863 | outputstr = "You need to create a Project before adding a Processing Unit" |
|
4005 | 3864 | self.console.clear() |
|
4006 | 3865 | self.console.append(outputstr) |
|
4007 | 3866 | return 0 |
|
4008 | 3867 | else: |
|
4009 | 3868 | self.addPUWindow() |
|
4010 | 3869 | self.console.clear() |
|
4011 | 3870 | self.console.append("Please, Choose the type of Processing Unit") |
|
4012 | 3871 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
4013 | 3872 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
4014 | 3873 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
4015 | 3874 | |
|
4016 | 3875 | if action == quitAction2: |
|
4017 | 3876 | index = self.selectedItemTree |
|
4018 | 3877 | try: |
|
4019 | 3878 | index.parent() |
|
4020 | 3879 | except: |
|
4021 | 3880 | self.console.append('Please first select a Project or Processing Unit') |
|
4022 | 3881 | return 0 |
|
4023 | 3882 | # print index.parent(),index |
|
4024 | 3883 | if index.parent() == None: |
|
4025 | 3884 | self.projectExplorerModel.removeRow(index.row()) |
|
4026 | 3885 | else: |
|
4027 | 3886 | index.parent().removeRow(index.row()) |
|
4028 | 3887 | self.removeItemTreeFromProject() |
|
4029 | 3888 | self.console.clear() |
|
4030 | 3889 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): |
|
4031 | 3890 | # print i.row() |
|
4032 | 3891 | |
|
4033 | 3892 | if action == quitAction3: |
|
4034 | 3893 | self.close() |
|
4035 | 3894 | return 0 |
|
4036 | 3895 | |
|
4037 | def refreshProjectWindow(self, project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, set): | |
|
4038 | ||
|
4039 | self.proName.setText(str(project_name)) | |
|
4040 | ||
|
4041 | if datatype == 'Voltage': | |
|
4042 | ext = '.r' | |
|
4043 | value = 0 | |
|
4044 | elif datatype == 'Spectra': | |
|
4045 | ext = '.pdata' | |
|
4046 | value = 1 | |
|
4047 | elif datatype == 'Fits': | |
|
4048 | ext = '.fits' | |
|
4049 | value = 2 | |
|
4050 | elif datatype == 'USRP': | |
|
4051 | ext = '.hdf5' | |
|
4052 | value = 3 | |
|
4053 | ||
|
4054 | self.proDataType.setText(ext) | |
|
4055 | self.proDataPath.setText(str(data_path)) | |
|
4056 | self.proComDataType.setCurrentIndex(value) | |
|
4057 | self.proComReadMode.setCurrentIndex(int(online)) | |
|
4058 | self.proDelay.setText(str(delay)) | |
|
4059 | self.proSet.setText(str(set)) | |
|
4060 | self.proComStartDate.clear() | |
|
4061 | self.proComEndDate.clear() | |
|
4062 | self.proComStartDate.addItem(str(startDate)) | |
|
4063 | self.proComEndDate.addItem(str(endDate)) | |
|
4064 | starTime = str(startTime) | |
|
4065 | starlist = starTime.split(":") | |
|
4066 | endTime = str(endTime) | |
|
4067 | endlist = endTime.split(":") | |
|
4068 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) | |
|
4069 | self.proStartTime.setTime(self.time) | |
|
4070 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) | |
|
4071 | self.proEndTime.setTime(self.time) | |
|
4072 | self.proDescription.clear() | |
|
4073 | self.proDescription.append(description) | |
|
4074 | ||
|
4075 | ||
|
4076 | def setspecGraph(self): | |
|
4077 | ||
|
4078 | self.specGgraphChannelList.setEnabled(True) | |
|
4079 | ||
|
4080 | def clearspecGraph(self): | |
|
4081 | ||
|
4082 | self.specGgraphChannelList.clear() | |
|
4083 | ||
|
4084 | def create_comm(self): | |
|
4085 | ||
|
4086 | self.commCtrlPThread = CommCtrlProcessThread() | |
|
4087 | self.commCtrlPThread.start() | |
|
4088 | ||
|
4089 | 3896 | def create_updating_timer(self): |
|
4090 | 3897 | self.comm_data_timer = QtCore.QTimer(self) |
|
4091 | 3898 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) |
|
4092 | 3899 | self.comm_data_timer.start(1000) |
|
4093 | ||
|
4094 | def create_figure(self): | |
|
4095 | self.queue_plot = Queue.Queue() | |
|
4096 | self.plotmanager = PlotManager(self.queue_plot) | |
|
4097 | self.plot_timer = QtCore.QTimer() | |
|
4098 | QtCore.QObject.connect(self.plot_timer, QtCore.SIGNAL("timeout()"), self.periodicCall) | |
|
4099 | self.plot_timer.start(100) | |
|
4100 | self.running = 1 | |
|
4101 | ||
|
4102 | def periodicCall(self): | |
|
4103 | """ | |
|
4104 | Check every 100 ms if there is something new in the queue. | |
|
4105 | """ | |
|
4106 | self.plotmanager.processIncoming() | |
|
4107 | if not self.running: | |
|
4108 | app.quit() | |
|
4109 | ||
|
4110 | # def on_comm_data_timer(self): | |
|
4111 | # # lee el data_queue y la coloca en el queue de ploteo | |
|
4112 | # try: | |
|
4113 | # reply = self.commCtrlPThread.data_q.get(block=False) | |
|
4114 | # self.queue_plot.put(reply.data) | |
|
4115 | # | |
|
4116 | # except Queue.Empty: | |
|
4117 | # pass | |
|
4118 | 3900 | |
|
4119 | 3901 | def createProjectView(self, id): |
|
4120 | 3902 | |
|
4121 | 3903 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4122 | 3904 | id = str(id) |
|
4123 | 3905 | projectParms = self.__getParmsFromProjectWindow() |
|
4124 | 3906 | |
|
4125 | 3907 | if not projectParms.isValid(): |
|
4126 | 3908 | return None |
|
4127 | 3909 | |
|
4128 | 3910 | projectObjView = Project() |
|
4129 | 3911 | projectObjView.setup(id=id, name=projectParms.name, description=projectParms.description) |
|
4130 | 3912 | |
|
4131 | 3913 | self.__projectObjDict[id] = projectObjView |
|
4132 | 3914 | self.addProject2ProjectExplorer(id=id, name=projectObjView.name) |
|
4133 | 3915 | |
|
4134 | 3916 | self.create = False |
|
4135 | 3917 | |
|
4136 | 3918 | return projectObjView |
|
4137 | 3919 | |
|
4138 | 3920 | def updateProjectView(self): |
|
4139 | 3921 | |
|
4140 | 3922 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4141 | 3923 | |
|
4142 | 3924 | projectParms = self.__getParmsFromProjectWindow() |
|
4143 | 3925 | |
|
4144 | 3926 | if not projectParms.isValid(): |
|
4145 | 3927 | return None |
|
4146 | 3928 | |
|
4147 | 3929 | projectObjView = self.getSelectedProjectObj() |
|
4148 | 3930 | projectObjView.update(name=projectParms.name, description=projectParms.description) |
|
4149 | 3931 | |
|
4150 | 3932 | return projectObjView |
|
4151 | 3933 | |
|
4152 | 3934 | def createReadUnitView(self, projectObjView): |
|
4153 | 3935 | |
|
4154 | 3936 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4155 | 3937 | |
|
4156 | 3938 | projectParms = self.__getParmsFromProjectWindow() |
|
4157 | 3939 | |
|
4158 | 3940 | if not projectParms.isValid(): |
|
4159 | 3941 | return None |
|
4160 | 3942 | |
|
4161 | 3943 | if projectParms.datatype in ("Voltage", "Spectra", "Fits"): |
|
4162 | 3944 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4163 | 3945 | path=projectParms.dpath, |
|
4164 | 3946 | startDate=projectParms.startDate, |
|
4165 | 3947 | endDate=projectParms.endDate, |
|
4166 | 3948 | startTime=projectParms.startTime, |
|
4167 | 3949 | endTime=projectParms.endTime, |
|
4168 | 3950 | online=projectParms.online, |
|
4169 | 3951 | walk=projectParms.walk |
|
4170 | 3952 | ) |
|
4171 | 3953 | |
|
4172 | 3954 | if projectParms.set: |
|
4173 | 3955 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4174 | 3956 | |
|
4175 | 3957 | if projectParms.delay: |
|
4176 | 3958 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4177 | 3959 | |
|
4178 | 3960 | if projectParms.datatype == "USRP": |
|
4179 | 3961 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4180 | 3962 | path=projectParms.dpath, |
|
4181 | 3963 | startDate=projectParms.startDate, |
|
4182 | 3964 | endDate=projectParms.endDate, |
|
4183 | 3965 | startTime=projectParms.startTime, |
|
4184 | 3966 | endTime=projectParms.endTime, |
|
4185 | 3967 | online=projectParms.online, |
|
4186 | 3968 | ippKm=projectParms.ippKm |
|
4187 | 3969 | ) |
|
4188 | 3970 | |
|
4189 | 3971 | if projectParms.delay: |
|
4190 | 3972 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4191 | 3973 | |
|
4192 | 3974 | return readUnitConfObj |
|
4193 | 3975 | |
|
4194 | 3976 | def updateReadUnitView(self, projectObjView, idReadUnit): |
|
4195 | 3977 | |
|
4196 | 3978 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk , set = self.getParmsFromProjectWindow() |
|
4197 | 3979 | |
|
4198 | 3980 | readUnitConfObj = projectObjView.getProcUnitObj(idReadUnit) |
|
4199 | 3981 | |
|
4200 | 3982 | projectParms = self.__getParmsFromProjectWindow() |
|
4201 | 3983 | |
|
4202 | 3984 | if not projectParms.isValid(): |
|
4203 | 3985 | return None |
|
4204 | 3986 | |
|
4205 | 3987 | if projectParms.datatype in ["Voltage", "Spectra", "Fits"]: |
|
4206 | 3988 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4207 | 3989 | path=projectParms.dpath, |
|
4208 | 3990 | startDate=projectParms.startDate, |
|
4209 | 3991 | endDate=projectParms.endDate, |
|
4210 | 3992 | startTime=projectParms.startTime, |
|
4211 | 3993 | endTime=projectParms.endTime, |
|
4212 | 3994 | online=projectParms.online, |
|
4213 | 3995 | walk=projectParms.walk |
|
4214 | 3996 | ) |
|
4215 | 3997 | if projectParms.set: |
|
4216 | 3998 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4217 | 3999 | |
|
4218 | 4000 | if projectParms.delay: |
|
4219 | 4001 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4220 | 4002 | |
|
4221 | 4003 | if projectParms.datatype == "USRP": |
|
4222 | 4004 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4223 | 4005 | path=projectParms.dpath, |
|
4224 | 4006 | startDate=projectParms.startDate, |
|
4225 | 4007 | endDate=projectParms.endDate, |
|
4226 | 4008 | startTime=projectParms.startTime, |
|
4227 | 4009 | endTime=projectParms.endTime, |
|
4228 | 4010 | online=projectParms.online, |
|
4229 | 4011 | ippKm=projectParms.ippKm |
|
4230 | 4012 | ) |
|
4231 | 4013 | |
|
4232 | 4014 | if projectParms.delay: |
|
4233 | 4015 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4234 | 4016 | |
|
4235 | 4017 | return readUnitConfObj |
|
4236 | 4018 | |
|
4237 | 4019 | def createProcUnitView(self, projectObjView, datatype, inputId): |
|
4238 | 4020 | |
|
4239 | 4021 | procUnitConfObj = projectObjView.addProcUnit(datatype=datatype, inputId=inputId) |
|
4240 | 4022 | |
|
4241 | 4023 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4242 | 4024 | |
|
4243 | 4025 | return procUnitConfObj |
|
4244 | 4026 | |
|
4245 | 4027 | def updateProcUnitView(self, id): |
|
4246 | 4028 | |
|
4247 | 4029 | procUnitConfObj = projectObjView.getProcUnitObj(id) |
|
4248 | 4030 | procUnitConfObj.removeOperations() |
|
4249 | 4031 | |
|
4250 | 4032 | return procUnitConfObj |
|
4251 | 4033 | |
|
4252 | 4034 | def addPUWindow(self): |
|
4253 | 4035 | |
|
4254 | 4036 | self.configUPWindowObj = UnitProcessWindow(self) |
|
4255 | 4037 | fatherObj = self.getSelectedItemObj() |
|
4256 | 4038 | try: |
|
4257 | 4039 | fatherObj.getElementName() |
|
4258 | 4040 | except: |
|
4259 | 4041 | self.console.append("First left click on Project or Processing Unit") |
|
4260 | 4042 | return 0 |
|
4261 | 4043 | |
|
4262 | 4044 | if fatherObj.getElementName() == 'Project': |
|
4263 | 4045 | readUnitConfObj = fatherObj.getReadUnitObj() |
|
4264 | 4046 | self.configUPWindowObj.dataTypeProject = str(readUnitConfObj.datatype) |
|
4265 | 4047 | |
|
4266 | 4048 | self.configUPWindowObj.getfromWindowList.append(fatherObj) |
|
4267 | 4049 | self.configUPWindowObj.loadTotalList() |
|
4268 | 4050 | self.configUPWindowObj.show() |
|
4269 | 4051 | self.configUPWindowObj.closed.connect(self.createPUWindow) |
|
4270 | 4052 | |
|
4271 | 4053 | def createPUWindow(self): |
|
4272 | 4054 | |
|
4273 | 4055 | if not self.configUPWindowObj.create: |
|
4274 | 4056 | return |
|
4275 | 4057 | |
|
4276 | 4058 | fatherObj = self.configUPWindowObj.getFromWindow |
|
4277 | 4059 | datatype = self.configUPWindowObj.typeofUP |
|
4278 | 4060 | |
|
4279 | 4061 | if fatherObj.getElementName() == 'Project': |
|
4280 | 4062 | inputId = fatherObj.getReadUnitId() |
|
4281 | 4063 | projectObjView = fatherObj |
|
4282 | 4064 | else: |
|
4283 | 4065 | inputId = fatherObj.getId() |
|
4284 | 4066 | projectObjView = self.getSelectedProjectObj() |
|
4285 | 4067 | |
|
4286 | #---------------------------- | |
|
4287 | 4068 | puObj = self.createProcUnitView(projectObjView, datatype, inputId) |
|
4288 | #---------------------------- | |
|
4289 | self.addPU2ProjectExplorer(id=puObj.getId(), name=datatype) | |
|
4290 | ||
|
4291 | self.showtabPUCreated(datatype) | |
|
4292 | ||
|
4293 | self.clearPUWindow(datatype) | |
|
4294 | ||
|
4295 | self.showPUinitView() | |
|
4296 | ||
|
4297 | def addFTPConf2Operation(self, puObj, opObj): | |
|
4298 | ||
|
4299 | if self.temporalFTP.create: | |
|
4300 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.temporalFTP.recover() | |
|
4301 | else: | |
|
4302 | self.temporalFTP.setwithoutconfiguration() | |
|
4303 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.temporalFTP.recover() | |
|
4304 | ||
|
4305 | # opObj.addParameter(name='server', value=server, format='str') | |
|
4306 | # opObj.addParameter(name='folder', value=remotefolder, format='str') | |
|
4307 | # opObj.addParameter(name='username', value=username, format='str') | |
|
4308 | # opObj.addParameter(name='password', value=password, format='str') | |
|
4309 | ||
|
4310 | if ftp_wei: | |
|
4311 | opObj.addParameter(name='ftp_wei', value=int(ftp_wei), format='int') | |
|
4312 | if exp_code: | |
|
4313 | opObj.addParameter(name='exp_code', value=int(exp_code), format='int') | |
|
4314 | if sub_exp_code: | |
|
4315 | opObj.addParameter(name='sub_exp_code', value=int(sub_exp_code), format='int') | |
|
4316 | if plot_pos: | |
|
4317 | opObj.addParameter(name='plot_pos', value=int(plot_pos), format='int') | |
|
4318 | ||
|
4319 | if puObj.datatype == "Spectra": | |
|
4320 | value = self.specGgraphftpratio.text() | |
|
4321 | if puObj.datatype == "SpectraHeis": | |
|
4322 | value = self.specHeisGgraphftpratio.text() | |
|
4323 | ||
|
4324 | if not value == "": | |
|
4325 | try: | |
|
4326 | value = int(value) | |
|
4327 | except: | |
|
4328 | self.console.clear() | |
|
4329 | self.console.append("Please fill Ratio on the textbox") | |
|
4330 | return 0 | |
|
4331 | ||
|
4332 | opObj.addParameter(name='wr_period', value=value, format='int') | |
|
4333 | ||
|
4334 | def addFTPProcUnitView(self, server, username, password, remotefolder, | |
|
4335 | ftp_wei, exp_code, sub_exp_code, plot_pos, | |
|
4336 | localfolder='./', extension='.png', period='60', protocol='ftp'): | |
|
4337 | ||
|
4338 | projectObj = self.getSelectedProjectObj() | |
|
4339 | procUnitConfObj = projectObj.getProcUnitObjByName(name="SendToServer") | |
|
4340 | ||
|
4341 | if not procUnitConfObj: | |
|
4342 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") | |
|
4343 | else: | |
|
4344 | procUnitConfObj.removeOperations() | |
|
4345 | ||
|
4346 | procUnitConfObj.addParameter(name='server', value=server, format='str') | |
|
4347 | procUnitConfObj.addParameter(name='username', value=username, format='str') | |
|
4348 | procUnitConfObj.addParameter(name='password', value=password, format='str') | |
|
4349 | procUnitConfObj.addParameter(name='localfolder', value=localfolder, format='str') | |
|
4350 | procUnitConfObj.addParameter(name='remotefolder', value=remotefolder, format='str') | |
|
4351 | procUnitConfObj.addParameter(name='ext', value=extension, format='str') | |
|
4352 | procUnitConfObj.addParameter(name='period', value=period, format='int') | |
|
4353 | procUnitConfObj.addParameter(name='protocol', value=protocol, format='str') | |
|
4354 | ||
|
4355 | procUnitConfObj.addParameter(name='ftp_wei', value=ftp_wei, format='str') | |
|
4356 | procUnitConfObj.addParameter(name='exp_code', value=exp_code, format='str') | |
|
4357 | procUnitConfObj.addParameter(name='sub_exp_code', value=sub_exp_code, format='str') | |
|
4358 | procUnitConfObj.addParameter(name='plot_pos', value=plot_pos, format='str') | |
|
4359 | ||
|
4360 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
|
4361 | ||
|
4362 | self.__ftpProcUnitAdded = True | |
|
4363 | self.__ftpProcUnitId = procUnitConfObj.getId() | |
|
4364 | ||
|
4365 | def removeFTPProcUnitView(self): | |
|
4366 | ||
|
4367 | projectObj = self.getSelectedProjectObj() | |
|
4368 | procUnitConfObj = projectObj.getProcUnitObjByName(name="SendToServer") | |
|
4369 | ||
|
4370 | self.__ftpProcUnitAdded = False | |
|
4371 | self.__ftpProcUnitId = None | |
|
4372 | ||
|
4373 | if not procUnitConfObj: | |
|
4374 | return | |
|
4375 | ||
|
4376 | projectObj.removeProcUnit(procUnitConfObj.getId()) | |
|
4377 | ||
|
4378 | if procUnitConfObj.getId() not in self.__puObjDict.keys(): | |
|
4379 | return | |
|
4380 | ||
|
4381 | self.__puObjDict.pop(procUnitConfObj.getId()) | |
|
4382 | ||
|
4383 | def bufferProject(self, caracteristica, principal, description): | |
|
4384 | ||
|
4385 | self.projectProperCaracteristica.append(caracteristica) | |
|
4386 | self.projectProperPrincipal.append(principal) | |
|
4387 | self.projectProperDescripcion.append(description) | |
|
4388 | return self.projectProperCaracteristica, self.projectProperPrincipal, self.projectProperDescripcion | |
|
4389 | ||
|
4390 | ||
|
4391 | def showProjectProperties(self, projectObjView): | |
|
4392 | ||
|
4393 | project_name, description = projectObjView.name, projectObjView.description | |
|
4394 | ||
|
4395 | id = projectObjView.id | |
|
4396 | readUnitId = projectObjView.getReadUnitId() | |
|
4397 | readUnitObj = projectObjView.getProcUnitObj(readUnitId) | |
|
4398 | operationObj = readUnitObj.getOperationObj(name='run') | |
|
4399 | ||
|
4400 | ||
|
4401 | datatype = operationObj.getParameterValue(parameterName='datatype') | |
|
4402 | dpath = operationObj.getParameterValue(parameterName='path') | |
|
4403 | startDate = operationObj.getParameterValue(parameterName='startDate') | |
|
4404 | endDate = operationObj.getParameterValue(parameterName='endDate') | |
|
4405 | startDate = str(startDate) | |
|
4406 | endDate = str(endDate) | |
|
4407 | startDateList = startDate.split('-') | |
|
4408 | endDateList = endDate.split('-') | |
|
4409 | startDate = startDateList[0] + "/" + startDateList[1] + "/" + startDateList[2] | |
|
4410 | endDate = endDateList[0] + "/" + endDateList[1] + "/" + endDateList[2] | |
|
4411 | ||
|
4412 | startTime = operationObj.getParameterValue(parameterName='startTime') | |
|
4413 | endTime = operationObj.getParameterValue(parameterName='endTime') | |
|
4414 | online = operationObj.getParameterValue(parameterName='online') | |
|
4415 | walk = operationObj.getParameterValue(parameterName='walk') | |
|
4416 | delay = operationObj.getParameterValue(parameterName='delay') | |
|
4417 | try: | |
|
4418 | set = operationObj.getParameterValue(parameterName='set') | |
|
4419 | except: | |
|
4420 | set = " " | |
|
4421 | ||
|
4422 | if online == 0: | |
|
4423 | remode = "offline" | |
|
4424 | else: | |
|
4425 | remode = "online" | |
|
4426 | ||
|
4427 | if walk == 0: | |
|
4428 | walk_str = 'On Files' | |
|
4429 | else: | |
|
4430 | walk_str = 'On Folder' | |
|
4431 | ||
|
4432 | self.bufferProject("Properties", "Name", project_name), | |
|
4433 | self.bufferProject("Properties", "Data Path", dpath) | |
|
4434 | self.bufferProject("Properties", "Workspace", self.pathWorkSpace) | |
|
4435 | self.bufferProject("Parameters", "Read Mode ", remode) | |
|
4436 | self.bufferProject("Parameters", "DataType ", datatype) | |
|
4437 | self.bufferProject("Parameters", "Start Date", str(startDate)) | |
|
4438 | self.bufferProject("Parameters", "End Date ", str(endDate)) | |
|
4439 | self.bufferProject("Parameters", "Start Time", str(startTime)) | |
|
4440 | self.bufferProject("Parameters", "End Time ", str(endTime)) | |
|
4441 | self.bufferProject("Parameters", "Delay ", str(delay)) | |
|
4442 | try: | |
|
4443 | set = operationObj.getParameterValue(parameterName='set') | |
|
4444 | self.bufferProject("Parameters", "Set ", set) | |
|
4445 | except: | |
|
4446 | set = " " | |
|
4447 | self.bufferProject("Parameters", "Walk ", str(walk_str)) | |
|
4448 | self.bufferProject("Parameters", "Time zone", "Local") | |
|
4449 | self.bufferProject("Description", "Summary ", description) | |
|
4450 | ||
|
4451 | self.propertiesModel = TreeModel() | |
|
4452 | self.propertiesModel.showProperties(self.projectProperCaracteristica, self.projectProperPrincipal, self.projectProperDescripcion) | |
|
4453 | self.treeProjectProperties.setModel(self.propertiesModel) | |
|
4454 | self.treeProjectProperties.expandAll() | |
|
4455 | self.treeProjectProperties.resizeColumnToContents(0) | |
|
4456 | self.treeProjectProperties.resizeColumnToContents(1) | |
|
4457 | ||
|
4458 | self.projectProperCaracteristica = [] | |
|
4459 | self.projectProperPrincipal = [] | |
|
4460 | self.projectProperDescripcion = [] | |
|
4461 | ||
|
4462 | return datatype , dpath , startDate , endDate, startTime, endTime, online, delay, walk, set | |
|
4463 | ||
|
4464 | def showPUinitView(self): | |
|
4465 | self.propertiesModel = TreeModel() | |
|
4466 | self.propertiesModel.initPUVoltageView() | |
|
4467 | self.treeProjectProperties.setModel(self.propertiesModel) | |
|
4468 | self.treeProjectProperties.expandAll() | |
|
4469 | self.treeProjectProperties.allColumnsShowFocus() | |
|
4470 | self.treeProjectProperties.resizeColumnToContents(1) | |
|
4471 | ||
|
4472 | def bufferVoltage(self, caracteristica, principal, description): | |
|
4473 | self.volProperCaracteristica.append(caracteristica) | |
|
4474 | self.volProperPrincipal.append(principal) | |
|
4475 | self.volProperDescripcion.append(description) | |
|
4476 | return self.volProperCaracteristica, self.volProperPrincipal, self.volProperDescripcion | |
|
4477 | ||
|
4478 | def showPUVoltageProperties(self, puObj): | |
|
4479 | ||
|
4480 | ||
|
4481 | type = puObj.name | |
|
4482 | self.bufferVoltage("Processing Unit", "Type", type) | |
|
4483 | ||
|
4484 | opObj = puObj.getOperationObj(name="setRadarFrequency") | |
|
4485 | if opObj == None: | |
|
4486 | radarfrequency = None | |
|
4487 | else: | |
|
4488 | value = opObj.getParameterValue(parameterName='frequency') | |
|
4489 | value = str(value) | |
|
4490 | radarfrequency = value | |
|
4491 | self.bufferVoltage("Processing Unit", "Radar Frequency", radarfrequency) | |
|
4492 | ||
|
4493 | opObj = puObj.getOperationObj(name="selectChannels") | |
|
4494 | if opObj == None: | |
|
4495 | channel = None | |
|
4496 | else: | |
|
4497 | value = opObj.getParameterValue(parameterName='channelList') | |
|
4498 | value = str(value)#[1:-1] | |
|
4499 | channel = value | |
|
4500 | self.bufferVoltage("Processing Unit", "Select Channel", channel) | |
|
4501 | ||
|
4502 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |
|
4503 | if opObj == None: | |
|
4504 | channel = None | |
|
4505 | else: | |
|
4506 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
|
4507 | value = str(value)#[1:-1] | |
|
4508 | channel = value | |
|
4509 | self.bufferVoltage("Processing Unit", "Select Channel by Index", channel) | |
|
4510 | ||
|
4511 | opObj = puObj.getOperationObj(name="selectHeights") | |
|
4512 | if opObj == None: | |
|
4513 | heights = None | |
|
4514 | else: | |
|
4515 | value1 = int(opObj.getParameterValue(parameterName='minHei')) | |
|
4516 | value1 = str(value1) | |
|
4517 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) | |
|
4518 | value2 = str(value2) | |
|
4519 | value = value1 + "," + value2 | |
|
4520 | heights = value | |
|
4521 | self.bufferVoltage("Processing Unit", "Select Heights", heights) | |
|
4522 | ||
|
4523 | ||
|
4524 | opObj = puObj.getOperationObj(name="filterByHeights") | |
|
4525 | if opObj == None: | |
|
4526 | filter = None | |
|
4527 | else: | |
|
4528 | value = opObj.getParameterValue(parameterName='window') | |
|
4529 | value = str(value) | |
|
4530 | filter = value | |
|
4531 | self.bufferVoltage("Processing Unit", "Filter", filter) | |
|
4532 | ||
|
4533 | ||
|
4534 | opObj = puObj.getOperationObj(name="ProfileSelector") | |
|
4535 | if opObj == None: | |
|
4536 | profile = None | |
|
4537 | else: | |
|
4538 | for parmObj in opObj.getParameterObjList(): | |
|
4539 | if parmObj.name == "profileRangeList": | |
|
4540 | value = opObj.getParameterValue(parameterName='profileRangeList') | |
|
4541 | value = str(value)#[1:-1] | |
|
4542 | profile = value | |
|
4543 | self.bufferVoltage("Processing Unit", "Select Profile", profile) | |
|
4544 | ||
|
4545 | if parmObj.name == "profileList": | |
|
4546 | value = opObj.getParameterValue(parameterName='profileList') | |
|
4547 | value = str(value)#[1:-1] | |
|
4548 | profile = value | |
|
4549 | self.bufferVoltage("Processing Unit", "Select Profile", profile) | |
|
4550 | ||
|
4551 | ||
|
4552 | opObj = puObj.getOperationObj(name="Decoder") | |
|
4553 | if opObj == None: | |
|
4554 | self.volOpCebDecodification.setCheckState(0) | |
|
4555 | code = None | |
|
4556 | mode = None | |
|
4557 | else: | |
|
4558 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) | |
|
4559 | try: | |
|
4560 | code = opObj.getParameterValue(parameterName='code') | |
|
4561 | nBaud = opObj.getParameterValue(parameterName='nBaud') | |
|
4562 | nCode = opObj.getParameterValue(parameterName='nCode') | |
|
4563 | code = numpy.array(code).reshape(nCode,nBaud) | |
|
4564 | except: | |
|
4565 | code = "Default" | |
|
4566 | ||
|
4567 | self.bufferVoltage("Processing Unit", "Code", str(code).replace('\n','')) | |
|
4568 | ||
|
4569 | try: | |
|
4570 | value = opObj.getParameterValue(parameterName='mode') | |
|
4571 | if int(value) == 0: | |
|
4572 | mode = "Time" | |
|
4573 | else: | |
|
4574 | mode = "freq" + str(value) | |
|
4575 | except: | |
|
4576 | mode = "Default" | |
|
4577 | self.bufferVoltage("Processing Unit", "Decoder mode", mode) | |
|
4578 | ||
|
4579 | opObj = puObj.getOperationObj(name="deFlip") | |
|
4580 | if opObj == None: | |
|
4581 | value = None | |
|
4582 | else: | |
|
4583 | try: | |
|
4584 | value = opObj.getParameterValue(parameterName='channelList') | |
|
4585 | value = str(value) | |
|
4586 | except: | |
|
4587 | value = "All channels" | |
|
4588 | ||
|
4589 | self.bufferVoltage("Processing Unit", "Flip", value) | |
|
4590 | ||
|
4591 | opObj = puObj.getOperationObj(name="CohInt") | |
|
4592 | if opObj == None: | |
|
4593 | coherentintegration = None | |
|
4594 | else: | |
|
4595 | value = opObj.getParameterValue(parameterName='n') | |
|
4596 | coherentintegration = value | |
|
4597 | self.bufferVoltage("Processing Unit", "Coh Int", coherentintegration) | |
|
4598 | ||
|
4599 | ||
|
4600 | # graph | |
|
4601 | # opObj = puObj.getOperationObj(name='Plot') | |
|
4602 | opObj = puObj.getOperationObj(name='Scope') | |
|
4603 | if opObj == None: | |
|
4604 | self.volGraphCebshow.setCheckState(0) | |
|
4605 | operation = "Disabled" | |
|
4606 | channelList = None | |
|
4607 | freq_vel = None | |
|
4608 | heightsrange = None | |
|
4609 | else: | |
|
4610 | operation = 'Enabled' | |
|
4611 | self.bufferVoltage("Scope", "Operation", operation), | |
|
4612 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) | |
|
4613 | value = opObj.getParameterObj(parameterName='channelList') | |
|
4614 | if value == None: | |
|
4615 | channelList = None | |
|
4616 | else: | |
|
4617 | value = opObj.getParameterValue(parameterName='channelList') | |
|
4618 | value = str(value)[1:-1] | |
|
4619 | channelList = value | |
|
4620 | self.bufferVoltage("Scope", "Channel List", channelList) | |
|
4621 | ||
|
4622 | ||
|
4623 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
4624 | if value1 == None: | |
|
4625 | freq_vel = None | |
|
4626 | else: | |
|
4627 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
4628 | value1 = str(value1) | |
|
4629 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
4630 | if value2 == None: | |
|
4631 | freq_vel = None | |
|
4632 | else: | |
|
4633 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
4634 | value2 = str(value2) | |
|
4635 | value = value1 + "," + value2 | |
|
4636 | freq_vel = value | |
|
4637 | self.bufferVoltage("Scope", "Freq/Vel", freq_vel) | |
|
4638 | ||
|
4639 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
4640 | if value1 == None: | |
|
4641 | heightsrange = None | |
|
4642 | else: | |
|
4643 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
4644 | value1 = str(value1) | |
|
4645 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
4646 | if value2 == None: | |
|
4647 | fheightsrange = None | |
|
4648 | else: | |
|
4649 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
4650 | value2 = str(value2) | |
|
4651 | value = value1 + "," + value2 | |
|
4652 | heightsrange = value | |
|
4653 | self.bufferVoltage("Scope", "Height Range", heightsrange) | |
|
4654 | ||
|
4655 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
4656 | if parmObj == None: | |
|
4657 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) | |
|
4658 | figpath = None | |
|
4659 | else: | |
|
4660 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) | |
|
4661 | value = opObj.getParameterValue(parameterName='figpath') | |
|
4662 | figpath = value | |
|
4663 | self.bufferVoltage("Scope", "Path", figpath) | |
|
4664 | # outputVoltageWrite | |
|
4665 | opObj = puObj.getOperationObj(name='VoltageWriter') | |
|
4666 | if opObj == None: | |
|
4667 | pass | |
|
4668 | else: | |
|
4669 | operation = 'Enabled' | |
|
4670 | self.bufferVoltage("Output", "Operation", operation) | |
|
4671 | value = opObj.getParameterObj(parameterName='path') | |
|
4672 | if value == None: | |
|
4673 | path = None | |
|
4674 | else: | |
|
4675 | value = opObj.getParameterValue(parameterName='path') | |
|
4676 | path = str(value) | |
|
4677 | self.bufferVoltage("Output", "Path", path) | |
|
4678 | value = opObj.getParameterObj(parameterName='blocksPerFile') | |
|
4679 | if value == None: | |
|
4680 | blocksperfile = None | |
|
4681 | else: | |
|
4682 | value = opObj.getParameterValue(parameterName='blocksPerFile') | |
|
4683 | blocksperfile = str(value) | |
|
4684 | self.bufferVoltage("Output", "BlocksPerFile", blocksperfile) | |
|
4685 | value = opObj.getParameterObj(parameterName='profilesPerBlock') | |
|
4686 | if value == None: | |
|
4687 | profilesPerBlock = None | |
|
4688 | else: | |
|
4689 | value = opObj.getParameterValue(parameterName='profilesPerBlock') | |
|
4690 | profilesPerBlock = str(value) | |
|
4691 | self.bufferVoltage("Output", "ProfilesPerBlock", profilesPerBlock) | |
|
4692 | ||
|
4693 | ||
|
4694 | # set model PU Properties | |
|
4695 | ||
|
4696 | self.propertiesModel = TreeModel() | |
|
4697 | self.propertiesModel.showProperties(self.volProperCaracteristica, self.volProperPrincipal, self.volProperDescripcion) | |
|
4698 | self.volProperCaracteristica = [] | |
|
4699 | self.volProperPrincipal = [] | |
|
4700 | self.volProperDescripcion = [] | |
|
4701 | self.treeProjectProperties.setModel(self.propertiesModel) | |
|
4702 | self.treeProjectProperties.expandAll() | |
|
4703 | self.treeProjectProperties.allColumnsShowFocus() | |
|
4704 | self.treeProjectProperties.resizeColumnToContents(0) | |
|
4705 | self.treeProjectProperties.resizeColumnToContents(1) | |
|
4706 | ||
|
4707 | def bufferSpectra(self, caracteristica, principal, description): | |
|
4708 | self.specProperCaracteristica.append(caracteristica) | |
|
4709 | self.specProperPrincipal.append(principal) | |
|
4710 | self.specProperDescripcion.append(description) | |
|
4711 | return self.specProperCaracteristica, self.specProperPrincipal, self.specProperDescripcion | |
|
4712 | ||
|
4713 | def showPUSpectraProperties(self, puObj): | |
|
4714 | type = puObj.name | |
|
4715 | self.bufferSpectra("Processing Unit", "Type", type) | |
|
4716 | ||
|
4717 | opObj = puObj.getOperationObj(name="setRadarFrequency") | |
|
4718 | if opObj == None: | |
|
4719 | radarfrequency = None | |
|
4720 | else: | |
|
4721 | value = opObj.getParameterValue(parameterName='frequency') | |
|
4722 | value = str(value) | |
|
4723 | radarfrequency = value | |
|
4724 | self.bufferSpectra("Processing Unit", "Radar Frequency", radarfrequency) | |
|
4725 | ||
|
4726 | ||
|
4727 | opObj = puObj.getOperationObj(name="run") | |
|
4728 | if opObj == None: | |
|
4729 | self.specOpnFFTpoints.clear() | |
|
4730 | self.specOpProfiles.clear() | |
|
4731 | self.specOpippFactor.clear() | |
|
4732 | else: | |
|
4733 | parmObj = opObj.getParameterObj(parameterName='nProfiles') | |
|
4734 | if parmObj == None: | |
|
4735 | nProfiles = None | |
|
4736 | else: | |
|
4737 | value = opObj.getParameterValue(parameterName='nProfiles') | |
|
4738 | nProfiles = value | |
|
4739 | self.bufferSpectra("Processing Unit", "nProfiles", nProfiles) | |
|
4740 | ||
|
4741 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') | |
|
4742 | if parmObj == None: | |
|
4743 | nFFTPoints = None | |
|
4744 | else: | |
|
4745 | value = opObj.getParameterValue(parameterName='nFFTPoints') | |
|
4746 | nFFTPoints = value | |
|
4747 | self.bufferSpectra("Processing Unit", "nFFTpoints", nFFTPoints) | |
|
4748 | ||
|
4749 | parmObj = opObj.getParameterObj(parameterName='ippFactor') | |
|
4750 | if parmObj == None: | |
|
4751 | ippFactor = None | |
|
4752 | else: | |
|
4753 | value = opObj.getParameterValue(parameterName='ippFactor') | |
|
4754 | ippFactor = value | |
|
4755 | self.bufferSpectra("Processing Unit", "Ipp Factor", ippFactor) | |
|
4756 | ||
|
4757 | ||
|
4758 | opObj = puObj.getOperationObj(name="run") | |
|
4759 | if opObj == None: | |
|
4760 | pairsList = None | |
|
4761 | else: | |
|
4762 | parm = opObj.getParameterObj(parameterName='pairsList') | |
|
4763 | if parm == None: | |
|
4764 | pairsList = None | |
|
4765 | else: | |
|
4766 | value = opObj.getParameterValue(parameterName='pairsList') | |
|
4767 | value = str(value)[1:-1] | |
|
4768 | pairsList = value | |
|
4769 | self.bufferSpectra("Processing Unit", "PairsList", pairsList) | |
|
4770 | ||
|
4771 | ||
|
4772 | opObj = puObj.getOperationObj(name="selectChannels") | |
|
4773 | if opObj == None: | |
|
4774 | channel = None | |
|
4775 | else: | |
|
4776 | try: | |
|
4777 | value = opObj.getParameterValue(parameterName='channelList') | |
|
4778 | value = str(value)[1:-1] | |
|
4779 | channel = value | |
|
4780 | ||
|
4781 | self.bufferSpectra("Processing Unit", "Channel List", channel) | |
|
4782 | except: | |
|
4783 | pass | |
|
4784 | try: | |
|
4785 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
|
4786 | value = str(value)[1:-1] | |
|
4787 | channel = value | |
|
4788 | ||
|
4789 | self.bufferSpectra("Processing Unit", "Channel Index List", channel) | |
|
4790 | except: | |
|
4791 | pass | |
|
4792 | ||
|
4793 | opObj = puObj.getOperationObj(name="selectHeights") | |
|
4794 | if opObj == None: | |
|
4795 | heights = None | |
|
4796 | else: | |
|
4797 | value1 = int(opObj.getParameterValue(parameterName='minHei')) | |
|
4798 | value1 = str(value1) | |
|
4799 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) | |
|
4800 | value2 = str(value2) | |
|
4801 | value = value1 + "," + value2 | |
|
4802 | heights = value | |
|
4803 | self.bufferSpectra("Processing Unit", "Heights", heights) | |
|
4804 | ||
|
4805 | opObj = puObj.getOperationObj(name="IncohInt") | |
|
4806 | if opObj == None: | |
|
4807 | incoherentintegration = None | |
|
4808 | else: | |
|
4809 | try: | |
|
4810 | value = opObj.getParameterValue(parameterName='timeInterval') | |
|
4811 | except: | |
|
4812 | value = opObj.getParameterValue(parameterName='n') | |
|
4813 | ||
|
4814 | value = float(value) | |
|
4815 | incoherentintegration = str(value) | |
|
4816 | self.bufferSpectra("Processing Unit", "Incoherent Integration", incoherentintegration) | |
|
4817 | ||
|
4818 | ||
|
4819 | opObj = puObj.getOperationObj(name="removeDC") | |
|
4820 | if opObj == None: | |
|
4821 | removeDC = None | |
|
4822 | else: | |
|
4823 | value = opObj.getParameterValue(parameterName='mode') | |
|
4824 | self.bufferSpectra("Processing Unit", "Remove DC", value) | |
|
4825 | ||
|
4826 | opObj = puObj.getOperationObj(name="removeInterference") | |
|
4827 | if opObj == None: | |
|
4828 | removeInterference = None | |
|
4829 | else: | |
|
4830 | self.bufferSpectra("Processing Unit", "Remove Interference", "1") | |
|
4831 | ||
|
4832 | opObj = puObj.getOperationObj(name="getNoise") | |
|
4833 | if opObj == None: | |
|
4834 | getNoise = None | |
|
4835 | else: | |
|
4836 | value1 = opObj.getParameterObj(parameterName='minHei') | |
|
4837 | if value1 == None: | |
|
4838 | getNoise = None | |
|
4839 | getNoise = "Default" | |
|
4840 | self.bufferSpectra("Processing Unit", "Get Noise", getNoise) | |
|
4841 | ||
|
4842 | else: | |
|
4843 | value1 = opObj.getParameterValue(parameterName='minHei') | |
|
4844 | value1 = str(value1) | |
|
4845 | value2 = opObj.getParameterObj(parameterName='maxHei') | |
|
4846 | if value2 == None: | |
|
4847 | getNoise = None | |
|
4848 | value = value1 | |
|
4849 | getNoise = value | |
|
4850 | self.bufferSpectra("Processing Unit", "Get Noise", getNoise) | |
|
4851 | else: | |
|
4852 | value2 = opObj.getParameterValue(parameterName='maxHei') | |
|
4853 | value2 = str(value2) | |
|
4854 | value3 = opObj.getParameterObj(parameterName='minVel') | |
|
4855 | if value3 == None: | |
|
4856 | getNoise = None | |
|
4857 | value = value1 + "," + value2 | |
|
4858 | getNoise = value | |
|
4859 | self.bufferSpectra("Processing Unit", "Get Noise", getNoise) | |
|
4860 | else: | |
|
4861 | value3 = opObj.getParameterValue(parameterName='minVel') | |
|
4862 | value3 = str(value3) | |
|
4863 | value4 = opObj.getParameterObj(parameterName='maxVel') | |
|
4864 | if value4 == None: | |
|
4865 | getNoise = None | |
|
4866 | value = value1 + "," + value2 + ',' + value3 | |
|
4867 | getNoise = value | |
|
4868 | self.bufferSpectra("Processing Unit", "Get Noise", getNoise) | |
|
4869 | else: | |
|
4870 | value4 = opObj.getParameterValue(parameterName='maxVel') | |
|
4871 | value4 = str(value4) | |
|
4872 | value = value1 + "," + value2 + ',' + value3 + ',' + value4 | |
|
4873 | getNoise = value | |
|
4874 | self.bufferSpectra("Processing Unit", "Get Noise", getNoise) | |
|
4875 | ||
|
4876 | opObj = puObj.getOperationObj(name='SpectraPlot') | |
|
4877 | # opObj = puObj.getOpObjfromParamValue(value="SpectraPlot") | |
|
4878 | ||
|
4879 | if opObj == None: | |
|
4880 | operationSpectraPlot = "Disabled" | |
|
4881 | freq_vel = None | |
|
4882 | heightsrange = None | |
|
4883 | channelListSpectraPlot = None | |
|
4884 | else: | |
|
4885 | operationSpectraPlot = "Enable" | |
|
4886 | self.bufferSpectra("Spectra Plot", "Operation", operationSpectraPlot) | |
|
4887 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
|
4888 | if parmObj == None: | |
|
4889 | channelListSpectraPlot = None | |
|
4890 | else: | |
|
4891 | value = opObj.getParameterValue(parameterName='channelList') | |
|
4892 | channelListSpectraPlot = str(value)[1:-1] | |
|
4893 | self.bufferSpectra("Spectra Plot", "Channel List", channelListSpectraPlot) | |
|
4894 | ||
|
4895 | ||
|
4896 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
4897 | if value1 == None: | |
|
4898 | freq_vel = None | |
|
4899 | else: | |
|
4900 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
4901 | value1 = str(value1) | |
|
4902 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
4903 | if value2 == None: | |
|
4904 | freq_vel = None | |
|
4905 | else: | |
|
4906 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
4907 | value2 = str(value2) | |
|
4908 | value = value1 + "," + value2 | |
|
4909 | freq_vel = value | |
|
4910 | self.bufferSpectra("Spectra Plot", "Freq/Vel", freq_vel) | |
|
4911 | ||
|
4912 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
4913 | if value1 == None: | |
|
4914 | heightsrange = None | |
|
4915 | else: | |
|
4916 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
4917 | value1 = str(value1) | |
|
4918 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
4919 | if value2 == None: | |
|
4920 | fheightsrange = None | |
|
4921 | else: | |
|
4922 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
4923 | value2 = str(value2) | |
|
4924 | value = value1 + "," + value2 | |
|
4925 | heightsrange = value | |
|
4926 | self.bufferSpectra("Spectra Plot", "Height Range", heightsrange) | |
|
4927 | ||
|
4928 | value1 = opObj.getParameterObj(parameterName='zmin') | |
|
4929 | if value1 == None: | |
|
4930 | dBrange = None | |
|
4931 | else: | |
|
4932 | value1 = opObj.getParameterValue(parameterName='zmin') | |
|
4933 | value1 = str(value1) | |
|
4934 | value2 = opObj.getParameterObj(parameterName='zmax') | |
|
4935 | if value2 == None: | |
|
4936 | fdBrange = None | |
|
4937 | else: | |
|
4938 | value2 = opObj.getParameterValue(parameterName='zmax') | |
|
4939 | value2 = str(value2) | |
|
4940 | value = value1 + "," + value2 | |
|
4941 | dbrange = value | |
|
4942 | self.bufferSpectra("Spectra Plot", "dB Range", dbrange) | |
|
4943 | ||
|
4944 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
4945 | if parmObj == None: | |
|
4946 | path = None | |
|
4947 | else: | |
|
4948 | path = opObj.getParameterValue(parameterName='figpath') | |
|
4949 | self.bufferSpectra("Spectra Plot", "Save Path", path) | |
|
4950 | ||
|
4951 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
|
4952 | if parmObj == None: | |
|
4953 | status = 'disable' | |
|
4954 | else: | |
|
4955 | status = 'enable' | |
|
4956 | self.bufferSpectra("Spectra Plot", "FTP", status) | |
|
4957 | self.showWr_Period(puObj, opObj, nameplotop="Spectra Plot") | |
|
4958 | # self.saveFTPvalues(opObj) | |
|
4959 | ||
|
4960 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') | |
|
4961 | # opObj = puObj.getOpObjfromParamValue(value="CrossSpectraPlot") | |
|
4962 | if opObj == None: | |
|
4963 | self.specGraphCebCrossSpectraplot.setCheckState(0) | |
|
4964 | operationCrossSpectraPlot = "Disabled" | |
|
4965 | channelList = None | |
|
4966 | freq_vel = None | |
|
4967 | heightsrange = None | |
|
4968 | else: | |
|
4969 | operationCrossSpectraPlot = "Enable" | |
|
4970 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) | |
|
4971 | self.bufferSpectra("Cross Spectra Plot", "Operation", operationCrossSpectraPlot) | |
|
4972 | ||
|
4973 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
4974 | if value1 == None: | |
|
4975 | freq_vel = None | |
|
4976 | else: | |
|
4977 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
4978 | value1 = str(value1) | |
|
4979 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
4980 | if value2 == None: | |
|
4981 | freq_vel = None | |
|
4982 | else: | |
|
4983 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
4984 | value2 = str(value2) | |
|
4985 | value = value1 + "," + value2 | |
|
4986 | freq_vel = value | |
|
4987 | self.bufferSpectra("Cross Spectra Plot", "Freq/Vel", freq_vel) | |
|
4988 | ||
|
4989 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
4990 | if value1 == None: | |
|
4991 | heightsrange = None | |
|
4992 | else: | |
|
4993 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
4994 | value1 = str(value1) | |
|
4995 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
4996 | if value2 == None: | |
|
4997 | fheightsrange = None | |
|
4998 | else: | |
|
4999 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
5000 | value2 = str(value2) | |
|
5001 | value = value1 + "," + value2 | |
|
5002 | heightsrange = value | |
|
5003 | self.bufferSpectra("Cross Spectra Plot", "Height Range", heightsrange) | |
|
5004 | ||
|
5005 | value1 = opObj.getParameterObj(parameterName='zmin') | |
|
5006 | if value1 == None: | |
|
5007 | dBrange = None | |
|
5008 | else: | |
|
5009 | value1 = opObj.getParameterValue(parameterName='zmin') | |
|
5010 | value1 = str(value1) | |
|
5011 | value2 = opObj.getParameterObj(parameterName='zmax') | |
|
5012 | if value2 == None: | |
|
5013 | fdBrange = None | |
|
5014 | else: | |
|
5015 | value2 = opObj.getParameterValue(parameterName='zmax') | |
|
5016 | value2 = str(value2) | |
|
5017 | value = value1 + "," + value2 | |
|
5018 | dbrange = value | |
|
5019 | self.bufferSpectra("Cross Spectra Plot", "dB Range", dbrange) | |
|
5020 | ||
|
5021 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
5022 | if parmObj == None: | |
|
5023 | path = None | |
|
5024 | else: | |
|
5025 | path = opObj.getParameterValue(parameterName='figpath') | |
|
5026 | self.bufferSpectra("Cross Spectra Plot", "Save Path", path) | |
|
5027 | ||
|
5028 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
|
5029 | if parmObj == None: | |
|
5030 | status = 'disable' | |
|
5031 | else: | |
|
5032 | status = 'enable' | |
|
5033 | self.bufferSpectra("Cross Spectra Plot", "FTP", status) | |
|
5034 | self.showWr_Period(puObj, opObj, nameplotop="Cross Spectra Plot") | |
|
5035 | # self.saveFTPvalues(opObj) | |
|
5036 | ||
|
5037 | opObj = puObj.getOperationObj(name='RTIPlot') | |
|
5038 | # opObj = puObj.getOpObjfromParamValue(value="RTIPlot") | |
|
5039 | if opObj == None: | |
|
5040 | self.specGraphCebRTIplot.setCheckState(0) | |
|
5041 | operationRTIPlot = "Disabled" | |
|
5042 | channelList = None | |
|
5043 | freq_vel = None | |
|
5044 | heightsrange = None | |
|
5045 | else: | |
|
5046 | operationRTIPlot = "Enable" | |
|
5047 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) | |
|
5048 | self.bufferSpectra("RTI Plot", "Operation", operationRTIPlot) | |
|
5049 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
|
5050 | if parmObj == None: | |
|
5051 | channelListRTIPlot = None | |
|
5052 | else: | |
|
5053 | value = opObj.getParameterValue(parameterName='channelList') | |
|
5054 | channelListRTIPlot = str(value)[1:-1] | |
|
5055 | self.bufferSpectra("RTI Plot", "Channel List", channelListRTIPlot) | |
|
5056 | ||
|
5057 | ||
|
5058 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
5059 | if value1 == None: | |
|
5060 | freq_vel = None | |
|
5061 | else: | |
|
5062 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
5063 | value1 = str(value1) | |
|
5064 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
5065 | if value2 == None: | |
|
5066 | freq_vel = None | |
|
5067 | else: | |
|
5068 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
5069 | value2 = str(value2) | |
|
5070 | value = value1 + "," + value2 | |
|
5071 | tmintmax = value | |
|
5072 | self.bufferSpectra("RTI Plot", "Tmin,Tmax", tmintmax) | |
|
5073 | ||
|
5074 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
|
5075 | if parmObj == None: | |
|
5076 | timerange = None | |
|
5077 | else: | |
|
5078 | value = opObj.getParameterValue(parameterName='timerange') | |
|
5079 | timerange = str(value) | |
|
5080 | self.bufferSpectra("RTI Plot", "Time Range", timerange) | |
|
5081 | ||
|
5082 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
5083 | if value1 == None: | |
|
5084 | heightsrange = None | |
|
5085 | else: | |
|
5086 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
5087 | value1 = str(value1) | |
|
5088 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
5089 | if value2 == None: | |
|
5090 | fheightsrange = None | |
|
5091 | else: | |
|
5092 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
5093 | value2 = str(value2) | |
|
5094 | value = value1 + "," + value2 | |
|
5095 | heightsrange = value | |
|
5096 | self.bufferSpectra("RTI Plot", "Height Range", heightsrange) | |
|
5097 | ||
|
5098 | value1 = opObj.getParameterObj(parameterName='zmin') | |
|
5099 | if value1 == None: | |
|
5100 | dBrange = None | |
|
5101 | else: | |
|
5102 | value1 = opObj.getParameterValue(parameterName='zmin') | |
|
5103 | value1 = str(value1) | |
|
5104 | value2 = opObj.getParameterObj(parameterName='zmax') | |
|
5105 | if value2 == None: | |
|
5106 | fdBrange = None | |
|
5107 | else: | |
|
5108 | value2 = opObj.getParameterValue(parameterName='zmax') | |
|
5109 | value2 = str(value2) | |
|
5110 | value = value1 + "," + value2 | |
|
5111 | dbrange = value | |
|
5112 | self.bufferSpectra("RTI Plot", "dB Range", dbrange) | |
|
5113 | ||
|
5114 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
5115 | if parmObj == None: | |
|
5116 | path = None | |
|
5117 | else: | |
|
5118 | path = opObj.getParameterValue(parameterName='figpath') | |
|
5119 | self.bufferSpectra("RTI Plot", "Save Path", path) | |
|
5120 | ||
|
5121 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
|
5122 | if parmObj == None: | |
|
5123 | status = 'disable' | |
|
5124 | else: | |
|
5125 | status = 'enable' | |
|
5126 | self.bufferSpectra("RTI Plot", "FTP", status) | |
|
5127 | self.showWr_Period(puObj, opObj, nameplotop="RTI Plot") | |
|
5128 | # self.saveFTPvalues(opObj) | |
|
5129 | ||
|
5130 | opObj = puObj.getOperationObj(name='CoherenceMap') | |
|
5131 | # opObj = puObj.getOpObjfromParamValue(value="CoherenceMap") | |
|
5132 | if opObj == None: | |
|
5133 | self.specGraphCebCoherencmap.setCheckState(0) | |
|
5134 | operationCoherenceMap = "Disabled" | |
|
5135 | channelList = None | |
|
5136 | freq_vel = None | |
|
5137 | heightsrange = None | |
|
5138 | else: | |
|
5139 | operationCoherenceMap = "Enable" | |
|
5140 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) | |
|
5141 | self.bufferSpectra("Coherence Map Plot", "Operation", operationCoherenceMap) | |
|
5142 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
|
5143 | if parmObj == None: | |
|
5144 | channelListRTIPlot = None | |
|
5145 | else: | |
|
5146 | value = opObj.getParameterValue(parameterName='channelList') | |
|
5147 | channelListRTIPlot = str(value)[1:-1] | |
|
5148 | self.bufferSpectra("Coherence Map Plot", "Channel List", channelListRTIPlot) | |
|
5149 | ||
|
5150 | ||
|
5151 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
5152 | if value1 == None: | |
|
5153 | freq_vel = None | |
|
5154 | else: | |
|
5155 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
5156 | value1 = str(value1) | |
|
5157 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
5158 | if value2 == None: | |
|
5159 | freq_vel = None | |
|
5160 | else: | |
|
5161 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
5162 | value2 = str(value2) | |
|
5163 | value = value1 + "," + value2 | |
|
5164 | tmintmax = value | |
|
5165 | self.bufferSpectra("Coherence Map Plot", "Tmin,Tmax", tmintmax) | |
|
5166 | ||
|
5167 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
|
5168 | if parmObj == None: | |
|
5169 | timerange = None | |
|
5170 | else: | |
|
5171 | value = opObj.getParameterValue(parameterName='timerange') | |
|
5172 | timerange = str(value) | |
|
5173 | self.bufferSpectra("Coherence Map Plot", "Time Range", timerange) | |
|
5174 | ||
|
5175 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
5176 | if value1 == None: | |
|
5177 | heightsrange = None | |
|
5178 | else: | |
|
5179 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
5180 | value1 = str(value1) | |
|
5181 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
5182 | if value2 == None: | |
|
5183 | fheightsrange = None | |
|
5184 | else: | |
|
5185 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
5186 | value2 = str(value2) | |
|
5187 | value = value1 + "," + value2 | |
|
5188 | heightsrange = value | |
|
5189 | self.bufferSpectra("Coherence Map Plot", "Height Range", heightsrange) | |
|
5190 | ||
|
5191 | value1 = opObj.getParameterObj(parameterName='zmin') | |
|
5192 | if value1 == None: | |
|
5193 | dBrange = None | |
|
5194 | else: | |
|
5195 | value1 = opObj.getParameterValue(parameterName='zmin') | |
|
5196 | value1 = str(value1) | |
|
5197 | value2 = opObj.getParameterObj(parameterName='zmax') | |
|
5198 | if value2 == None: | |
|
5199 | fdBrange = None | |
|
5200 | else: | |
|
5201 | value2 = opObj.getParameterValue(parameterName='zmax') | |
|
5202 | value2 = str(value2) | |
|
5203 | value = value1 + "," + value2 | |
|
5204 | dbrange = value | |
|
5205 | self.bufferSpectra("Coherence Map Plot", "Magnitud", dbrange) | |
|
5206 | ||
|
5207 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
5208 | if parmObj == None: | |
|
5209 | path = None | |
|
5210 | else: | |
|
5211 | path = opObj.getParameterValue(parameterName='figpath') | |
|
5212 | self.bufferSpectra("Coherence Map Plot", "Save Path", path) | |
|
5213 | ||
|
5214 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
|
5215 | if parmObj == None: | |
|
5216 | status = 'disable' | |
|
5217 | else: | |
|
5218 | status = 'enable' | |
|
5219 | self.bufferSpectra("Coherence Map Plot", "FTP", status) | |
|
5220 | self.showWr_Period(puObj, opObj, nameplotop="Coherence Map Plot") | |
|
5221 | # self.saveFTPvalues(opObj) | |
|
5222 | ||
|
5223 | ||
|
5224 | opObj = puObj.getOperationObj(name='PowerProfilePlot') | |
|
5225 | # opObj = puObj.getOpObjfromParamValue(value="PowerProfilePlot") | |
|
5226 | if opObj == None: | |
|
5227 | self.specGraphPowerprofile.setCheckState(0) | |
|
5228 | operationPowerProfilePlot = "Disabled" | |
|
5229 | channelList = None | |
|
5230 | freq_vel = None | |
|
5231 | heightsrange = None | |
|
5232 | else: | |
|
5233 | operationPowerProfilePlot = "Enable" | |
|
5234 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) | |
|
5235 | self.bufferSpectra("PowerProfile Plot", "Operation", operationPowerProfilePlot) | |
|
5236 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
|
5237 | if parmObj == None: | |
|
5238 | channelListSpectraPlot = None | |
|
5239 | else: | |
|
5240 | value = opObj.getParameterValue(parameterName='channelList') | |
|
5241 | channelListSpectraPlot = str(value)[1:-1] | |
|
5242 | self.bufferSpectra("PowerProfile Plot", "Channel List", channelListSpectraPlot) | |
|
5243 | ||
|
5244 | ||
|
5245 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
5246 | if value1 == None: | |
|
5247 | freq_vel = None | |
|
5248 | else: | |
|
5249 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
5250 | value1 = str(value1) | |
|
5251 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
5252 | if value2 == None: | |
|
5253 | freq_vel = None | |
|
5254 | else: | |
|
5255 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
5256 | value2 = str(value2) | |
|
5257 | value = value1 + "," + value2 | |
|
5258 | dbrange = value | |
|
5259 | self.bufferSpectra("PowerProfile Plot", "dbRange", dbrange) | |
|
5260 | ||
|
5261 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
5262 | if value1 == None: | |
|
5263 | heightsrange = None | |
|
5264 | else: | |
|
5265 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
5266 | value1 = str(value1) | |
|
5267 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
5268 | if value2 == None: | |
|
5269 | fheightsrange = None | |
|
5270 | else: | |
|
5271 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
5272 | value2 = str(value2) | |
|
5273 | value = value1 + "," + value2 | |
|
5274 | heightsrange = value | |
|
5275 | self.bufferSpectra("PowerProfile Plot", "Height Range", heightsrange) | |
|
5276 | ||
|
5277 | ||
|
5278 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
5279 | if parmObj == None: | |
|
5280 | path = None | |
|
5281 | else: | |
|
5282 | path = opObj.getParameterValue(parameterName='figpath') | |
|
5283 | self.bufferSpectra("PowerProfile Plot", "Save Path", path) | |
|
5284 | ||
|
5285 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
|
5286 | if parmObj == None: | |
|
5287 | status = 'disable' | |
|
5288 | else: | |
|
5289 | status = 'enable' | |
|
5290 | self.bufferSpectra("PowerProfile Plot", "FTP", status) | |
|
5291 | self.showWr_Period(puObj, opObj, nameplotop="PowerProfile Plot") | |
|
5292 | # self.saveFTPvalues(opObj) | |
|
5293 | ||
|
5294 | # noise | |
|
5295 | opObj = puObj.getOperationObj(name='Noise') | |
|
5296 | # opObj = puObj.getOpObjfromParamValue(value="Noise") | |
|
5297 | if opObj == None: | |
|
5298 | self.specGraphCebRTInoise.setCheckState(0) | |
|
5299 | operationRTINoise = "Disabled" | |
|
5300 | channelList = None | |
|
5301 | freq_vel = None | |
|
5302 | dbRange = None | |
|
5303 | else: | |
|
5304 | operationRTINoise = "Enable" | |
|
5305 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) | |
|
5306 | self.bufferSpectra("Noise Plot", "Operation", operationRTINoise) | |
|
5307 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
|
5308 | if parmObj == None: | |
|
5309 | channelListRTINoise = None | |
|
5310 | else: | |
|
5311 | value = opObj.getParameterValue(parameterName='channelList') | |
|
5312 | channelListRTINoise = str(value)[1:-1] | |
|
5313 | self.bufferSpectra("Noise Plot", "Channel List", channelListRTINoise) | |
|
5314 | ||
|
5315 | ||
|
5316 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
5317 | if value1 == None: | |
|
5318 | freq_vel = None | |
|
5319 | else: | |
|
5320 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
5321 | value1 = str(value1) | |
|
5322 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
5323 | if value2 == None: | |
|
5324 | freq_vel = None | |
|
5325 | else: | |
|
5326 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
5327 | value2 = str(value2) | |
|
5328 | value = value1 + "," + value2 | |
|
5329 | tmintmax = value | |
|
5330 | self.bufferSpectra("Noise Plot", "Tmin,Tmax", tmintmax) | |
|
5331 | ||
|
5332 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
|
5333 | if parmObj == None: | |
|
5334 | timerange = None | |
|
5335 | else: | |
|
5336 | value = opObj.getParameterValue(parameterName='timerange') | |
|
5337 | timerange = str(value) | |
|
5338 | self.bufferSpectra("Noise Plot", "Time Range", timerange) | |
|
5339 | ||
|
5340 | ||
|
5341 | ||
|
5342 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
5343 | if value1 == None: | |
|
5344 | DBrange = None | |
|
5345 | else: | |
|
5346 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
5347 | value1 = str(value1) | |
|
5348 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
5349 | if value2 == None: | |
|
5350 | fdBrange = None | |
|
5351 | else: | |
|
5352 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
5353 | value2 = str(value2) | |
|
5354 | value = value1 + "," + value2 | |
|
5355 | dBrange = value | |
|
5356 | self.bufferSpectra("Noise Plot", "dB Range", dBrange) | |
|
5357 | ||
|
5358 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
5359 | if parmObj == None: | |
|
5360 | path = None | |
|
5361 | else: | |
|
5362 | path = opObj.getParameterValue(parameterName='figpath') | |
|
5363 | self.bufferSpectra("Noise Plot", "Save Path", path) | |
|
5364 | ||
|
5365 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
|
5366 | if parmObj == None: | |
|
5367 | status = 'disable' | |
|
5368 | else: | |
|
5369 | status = 'enable' | |
|
5370 | self.bufferSpectra("Noise Plot", "FTP", status) | |
|
5371 | self.showWr_Period(puObj, opObj, nameplotop="Noise Plot") | |
|
5372 | # self.saveFTPvalues(opObj) | |
|
5373 | ||
|
5374 | # outputSpectraWrite | |
|
5375 | opObj = puObj.getOperationObj(name='SpectraWriter') | |
|
5376 | if opObj == None: | |
|
5377 | pass | |
|
5378 | else: | |
|
5379 | operation = 'Enabled' | |
|
5380 | self.bufferSpectra("Output", "Operation", operation) | |
|
5381 | value = opObj.getParameterObj(parameterName='path') | |
|
5382 | if value == None: | |
|
5383 | path = None | |
|
5384 | else: | |
|
5385 | value = opObj.getParameterValue(parameterName='path') | |
|
5386 | path = str(value) | |
|
5387 | self.bufferSpectra("Output", "Path", path) | |
|
5388 | value = opObj.getParameterObj(parameterName='blocksPerFile') | |
|
5389 | if value == None: | |
|
5390 | blocksperfile = None | |
|
5391 | else: | |
|
5392 | value = opObj.getParameterValue(parameterName='blocksPerFile') | |
|
5393 | blocksperfile = str(value) | |
|
5394 | self.bufferSpectra("Output", "BlocksPerFile", blocksperfile) | |
|
5395 | value = opObj.getParameterObj(parameterName='profilesPerBlock') | |
|
5396 | if value == None: | |
|
5397 | profilesPerBlock = None | |
|
5398 | else: | |
|
5399 | value = opObj.getParameterValue(parameterName='profilesPerBlock') | |
|
5400 | profilesPerBlock = str(value) | |
|
5401 | self.bufferSpectra("Output", "ProfilesPerBlock", profilesPerBlock) | |
|
5402 | ||
|
5403 | projectObj = self.getSelectedProjectObj() | |
|
5404 | ftpProcUnitConfObj = projectObj.getProcUnitObjByName(name="SendToServer") | |
|
5405 | ||
|
5406 | if ftpProcUnitConfObj: | |
|
5407 | ||
|
5408 | opObj = ftpProcUnitConfObj.getOperationObj(name='run') | |
|
5409 | ||
|
5410 | server = opObj.getParameterValue(parameterName='server') | |
|
5411 | folder = opObj.getParameterValue(parameterName='remotefolder') | |
|
5412 | username = opObj.getParameterValue(parameterName='username') | |
|
5413 | password = opObj.getParameterValue(parameterName='password') | |
|
5414 | ftp_wei = opObj.getParameterValue(parameterName='ftp_wei') | |
|
5415 | exp_code = opObj.getParameterValue(parameterName='exp_code') | |
|
5416 | sub_exp_code = opObj.getParameterValue(parameterName='sub_exp_code') | |
|
5417 | plot_pos = opObj.getParameterValue(parameterName='plot_pos') | |
|
5418 | localfolder = opObj.getParameterValue(parameterName='localfolder') | |
|
5419 | ||
|
5420 | self.bufferSpectra("FTP", "Server", server) | |
|
5421 | self.bufferSpectra("FTP", "Remote folder", folder) | |
|
5422 | self.bufferSpectra("FTP", "Local folder", localfolder) | |
|
5423 | self.bufferSpectra("FTP", "Username", username) | |
|
5424 | self.bufferSpectra("FTP", "Password", '*'*len(password)) | |
|
5425 | self.bufferSpectra("FTP", "Ftp_wei", ftp_wei) | |
|
5426 | self.bufferSpectra("FTP", "Exp_code", exp_code) | |
|
5427 | self.bufferSpectra("FTP", "Sub_exp_code", sub_exp_code) | |
|
5428 | self.bufferSpectra("FTP", "Plot_pos", plot_pos) | |
|
5429 | ||
|
5430 | # set model PU Properties | |
|
5431 | ||
|
5432 | self.propertiesModel = TreeModel() | |
|
5433 | self.propertiesModel.showProperties(self.specProperCaracteristica, self.specProperPrincipal, self.specProperDescripcion) | |
|
5434 | ||
|
5435 | self.treeProjectProperties.setModel(self.propertiesModel) | |
|
5436 | self.treeProjectProperties.expandAll() | |
|
5437 | self.treeProjectProperties.allColumnsShowFocus() | |
|
5438 | self.treeProjectProperties.resizeColumnToContents(0) | |
|
5439 | self.treeProjectProperties.resizeColumnToContents(1) | |
|
5440 | ||
|
5441 | self.specProperCaracteristica = [] | |
|
5442 | self.specProperDescripcion = [] | |
|
5443 | self.specProperPrincipal = [] | |
|
5444 | 4069 | |
|
4070 | self.addPU2ProjectExplorer(id=puObj.getId(), name=datatype) | |
|
5445 | 4071 | |
|
5446 | def bufferSpectraHeis(self, caracteristica, principal, description): | |
|
5447 | self.specHeisProperCaracteristica.append(caracteristica) | |
|
5448 | self.specHeisProperPrincipal.append(principal) | |
|
5449 | self.specHeisProperDescripcion.append(description) | |
|
5450 | return self.specHeisProperCaracteristica, self.specHeisProperPrincipal, self.specHeisProperDescripcion | |
|
5451 | ||
|
4072 | self.showtabPUCreated(datatype) | |
|
5452 | 4073 | |
|
5453 | def showPUSpectraHeisProperties(self, puObj): | |
|
5454 | type = puObj.name | |
|
5455 | self.bufferSpectraHeis("Processing Unit", "Type", type) | |
|
4074 | self.clearPUWindow(datatype) | |
|
5456 | 4075 | |
|
5457 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") | |
|
5458 | if opObj == None: | |
|
5459 | incoherentintegration = None | |
|
5460 | else: | |
|
5461 | value = opObj.getParameterValue(parameterName='timeInterval') | |
|
5462 | value = float(value) | |
|
5463 | incoherentintegration = str(value) | |
|
5464 | self.bufferSpectraHeis("Processing Unit", "Incoherent Integration", incoherentintegration) | |
|
5465 | # spectraheis graph | |
|
5466 | opObj = puObj.getOperationObj(name='SpectraHeisScope') | |
|
5467 | # opObj = puObj.getOpObjfromParamValue(value="SpectraHeisScope") | |
|
5468 | if opObj == None: | |
|
5469 | self.specHeisGraphCebSpectraplot.setCheckState(0) | |
|
5470 | operationSpectraHeisPlot = "Disabled" | |
|
5471 | xmin_xmax = None | |
|
5472 | ymin_ymax = None | |
|
5473 | channelListSpectraPlot = None | |
|
4076 | self.showPUinitView() | |
|
4077 | ||
|
4078 | def addFTPConf2Operation(self, puObj, opObj): | |
|
4079 | ||
|
4080 | if self.temporalFTP.create: | |
|
4081 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.temporalFTP.recover() | |
|
5474 | 4082 | else: |
|
5475 | operationSpectraHeisPlot = "Enable" | |
|
5476 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) | |
|
5477 | self.bufferSpectraHeis("SpectraHeis Plot", "Operation", operationSpectraHeisPlot) | |
|
5478 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
|
5479 | if parmObj == None: | |
|
5480 | channelListSpectraPlot = None | |
|
5481 | else: | |
|
5482 | value = opObj.getParameterValue(parameterName='channelList') | |
|
5483 | channelListSpectraPlot = str(value)[1:-1] | |
|
5484 | self.bufferSpectraHeis("SpectraHeis Plot", "Channel List", channelListSpectraPlot) | |
|
5485 | ||
|
5486 | ||
|
5487 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
5488 | if value1 == None: | |
|
5489 | xmin_xmax = None | |
|
5490 | else: | |
|
5491 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
5492 | value1 = str(value1) | |
|
5493 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
5494 | if value2 == None: | |
|
5495 | xmin_xmax = None | |
|
5496 | else: | |
|
5497 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
5498 | value2 = str(value2) | |
|
5499 | value = value1 + "," + value2 | |
|
5500 | xmin_xmax = value | |
|
5501 | self.bufferSpectraHeis("SpectraHeis Plot", "Xmin-Xmax", xmin_xmax) | |
|
5502 | ||
|
5503 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
5504 | if value1 == None: | |
|
5505 | ymin_ymax = None | |
|
5506 | else: | |
|
5507 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
5508 | value1 = str(value1) | |
|
5509 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
5510 | if value2 == None: | |
|
5511 | ymin_ymax = None | |
|
5512 | else: | |
|
5513 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
5514 | value2 = str(value2) | |
|
5515 | value = value1 + "," + value2 | |
|
5516 | ymin_ymax = value | |
|
5517 | self.bufferSpectraHeis("SpectraHeis Plot", "Ymin-Ymax", ymin_ymax) | |
|
5518 | ||
|
5519 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
5520 | if parmObj == None: | |
|
5521 | path = None | |
|
5522 | else: | |
|
5523 | path = opObj.getParameterValue(parameterName='figpath') | |
|
5524 | self.bufferSpectraHeis("SpectraHeis Plot", "Save Path", path) | |
|
4083 | self.temporalFTP.setwithoutconfiguration() | |
|
4084 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.temporalFTP.recover() | |
|
4085 | ||
|
4086 | # opObj.addParameter(name='server', value=server, format='str') | |
|
4087 | # opObj.addParameter(name='folder', value=remotefolder, format='str') | |
|
4088 | # opObj.addParameter(name='username', value=username, format='str') | |
|
4089 | # opObj.addParameter(name='password', value=password, format='str') | |
|
4090 | ||
|
4091 | if ftp_wei: | |
|
4092 | opObj.addParameter(name='ftp_wei', value=int(ftp_wei), format='int') | |
|
4093 | if exp_code: | |
|
4094 | opObj.addParameter(name='exp_code', value=int(exp_code), format='int') | |
|
4095 | if sub_exp_code: | |
|
4096 | opObj.addParameter(name='sub_exp_code', value=int(sub_exp_code), format='int') | |
|
4097 | if plot_pos: | |
|
4098 | opObj.addParameter(name='plot_pos', value=int(plot_pos), format='int') | |
|
5525 | 4099 | |
|
5526 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
|
5527 | if parmObj == None: | |
|
5528 | status = 'disable' | |
|
5529 | else: | |
|
5530 | status = 'enable' | |
|
5531 | self.bufferSpectraHeis("SpectraHeis Plot", "FTP", status) | |
|
5532 | self.showWr_Period(puObj, opObj, nameplotop="SpectraHeis Plot") | |
|
5533 | # self.saveFTPvalues(opObj) | |
|
5534 | ||
|
5535 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') | |
|
5536 | # opObj = puObj.getOpObjfromParamValue(value="RTIfromSpectraHeis") | |
|
5537 | if opObj == None: | |
|
5538 | self.specHeisGraphCebRTIplot.setCheckState(0) | |
|
5539 | operationRTIPlot = "Disabled" | |
|
5540 | channelList = None | |
|
5541 | freq_vel = None | |
|
5542 | heightsrange = None | |
|
4100 | if puObj.datatype == "Spectra": | |
|
4101 | value = self.specGgraphftpratio.text() | |
|
4102 | if puObj.datatype == "SpectraHeis": | |
|
4103 | value = self.specHeisGgraphftpratio.text() | |
|
4104 | ||
|
4105 | if not value == "": | |
|
4106 | try: | |
|
4107 | value = int(value) | |
|
4108 | opObj.addParameter(name='wr_period', value=value, format='int') | |
|
4109 | except: | |
|
4110 | pass | |
|
4111 | ||
|
4112 | ||
|
4113 | def addFTPProcUnitView(self, server, username, password, remotefolder, | |
|
4114 | ftp_wei, exp_code, sub_exp_code, plot_pos, | |
|
4115 | localfolder='./', extension='.png', period='60', protocol='ftp'): | |
|
4116 | ||
|
4117 | projectObj = self.getSelectedProjectObj() | |
|
4118 | procUnitConfObj = projectObj.getProcUnitObjByName(name="SendToServer") | |
|
4119 | ||
|
4120 | if not procUnitConfObj: | |
|
4121 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") | |
|
5543 | 4122 | else: |
|
5544 | operationRTIPlot = "Enable" | |
|
5545 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) | |
|
5546 | self.bufferSpectraHeis("RTIHeis Plot", "Operation", operationRTIPlot) | |
|
5547 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
|
5548 | if parmObj == None: | |
|
5549 | channelListRTIPlot = None | |
|
5550 | else: | |
|
5551 | value = opObj.getParameterValue(parameterName='channelList') | |
|
5552 | channelListRTIPlot = str(value)[1:-1] | |
|
5553 | self.bufferSpectraHeis("RTIHeis Plot", "Channel List", channelListRTIPlot) | |
|
5554 | ||
|
5555 | ||
|
5556 | value1 = opObj.getParameterObj(parameterName='xmin') | |
|
5557 | if value1 == None: | |
|
5558 | freq_vel = None | |
|
5559 | else: | |
|
5560 | value1 = opObj.getParameterValue(parameterName='xmin') | |
|
5561 | value1 = str(value1) | |
|
5562 | value2 = opObj.getParameterObj(parameterName='xmax') | |
|
5563 | if value2 == None: | |
|
5564 | freq_vel = None | |
|
5565 | else: | |
|
5566 | value2 = opObj.getParameterValue(parameterName='xmax') | |
|
5567 | value2 = str(value2) | |
|
5568 | value = value1 + "," + value2 | |
|
5569 | tmintmax = value | |
|
5570 | self.bufferSpectraHeis("RTIHeis Plot", "Tmin,Tmax", tmintmax) | |
|
5571 | ||
|
5572 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
|
5573 | if parmObj == None: | |
|
5574 | timerange = None | |
|
5575 | else: | |
|
5576 | value = opObj.getParameterValue(parameterName='timerange') | |
|
5577 | timerange = str(value) | |
|
5578 | self.bufferSpectraHeis("RTIHeis Plot", "Time Range", timerange) | |
|
5579 | ||
|
5580 | value1 = opObj.getParameterObj(parameterName='ymin') | |
|
5581 | if value1 == None: | |
|
5582 | heightsrange = None | |
|
5583 | else: | |
|
5584 | value1 = opObj.getParameterValue(parameterName='ymin') | |
|
5585 | value1 = str(value1) | |
|
5586 | value2 = opObj.getParameterObj(parameterName='ymax') | |
|
5587 | if value2 == None: | |
|
5588 | fheightsrange = None | |
|
5589 | else: | |
|
5590 | value2 = opObj.getParameterValue(parameterName='ymax') | |
|
5591 | value2 = str(value2) | |
|
5592 | value = value1 + "," + value2 | |
|
5593 | heightsrange = value | |
|
5594 | self.bufferSpectraHeis("RTIHeis Plot", "Ymin-Ymax", heightsrange) | |
|
4123 | procUnitConfObj.removeOperations() | |
|
5595 | 4124 | |
|
5596 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
|
5597 | if parmObj == None: | |
|
5598 | path = None | |
|
5599 | else: | |
|
5600 | path = opObj.getParameterValue(parameterName='figpath') | |
|
5601 | self.bufferSpectraHeis("RTIHeis Plot", "Save Path", path) | |
|
4125 | procUnitConfObj.addParameter(name='server', value=server, format='str') | |
|
4126 | procUnitConfObj.addParameter(name='username', value=username, format='str') | |
|
4127 | procUnitConfObj.addParameter(name='password', value=password, format='str') | |
|
4128 | procUnitConfObj.addParameter(name='localfolder', value=localfolder, format='str') | |
|
4129 | procUnitConfObj.addParameter(name='remotefolder', value=remotefolder, format='str') | |
|
4130 | procUnitConfObj.addParameter(name='ext', value=extension, format='str') | |
|
4131 | procUnitConfObj.addParameter(name='period', value=period, format='int') | |
|
4132 | procUnitConfObj.addParameter(name='protocol', value=protocol, format='str') | |
|
4133 | ||
|
4134 | procUnitConfObj.addParameter(name='ftp_wei', value=ftp_wei, format='str') | |
|
4135 | procUnitConfObj.addParameter(name='exp_code', value=exp_code, format='str') | |
|
4136 | procUnitConfObj.addParameter(name='sub_exp_code', value=sub_exp_code, format='str') | |
|
4137 | procUnitConfObj.addParameter(name='plot_pos', value=plot_pos, format='str') | |
|
5602 | 4138 | |
|
5603 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
|
5604 | if parmObj == None: | |
|
5605 | status = 'disable' | |
|
5606 | else: | |
|
5607 | status = 'enable' | |
|
5608 | self.bufferSpectraHeis("RTIHeis Plot", "FTP", status) | |
|
5609 | self.showWr_Period(puObj, opObj, nameplotop="RTIHeis Plot") | |
|
5610 | # self.saveFTPvalues(opObj) | |
|
4139 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
|
4140 | ||
|
4141 | self.__ftpProcUnitAdded = True | |
|
4142 | self.__ftpProcUnitId = procUnitConfObj.getId() | |
|
5611 | 4143 | |
|
5612 | # outputSpectraHeisWrite | |
|
5613 | opObj = puObj.getOperationObj(name='FitsWriter') | |
|
5614 | if opObj == None: | |
|
5615 | pass | |
|
5616 | else: | |
|
5617 | operation = 'Enabled' | |
|
5618 | self.bufferSpectraHeis("Output", "Operation", operation) | |
|
5619 | value = opObj.getParameterObj(parameterName='path') | |
|
5620 | if value == None: | |
|
5621 | path = None | |
|
5622 | else: | |
|
5623 | value = opObj.getParameterValue(parameterName='path') | |
|
5624 | path = str(value) | |
|
5625 | self.bufferSpectraHeis("Output", "Path", path) | |
|
5626 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') | |
|
5627 | if value == None: | |
|
5628 | blocksperfile = None | |
|
5629 | else: | |
|
5630 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') | |
|
5631 | blocksperfile = str(value) | |
|
5632 | self.bufferSpectraHeis("Output", "BlocksPerFile", blocksperfile) | |
|
5633 | value = opObj.getParameterObj(parameterName='metadatafile') | |
|
5634 | if value == None: | |
|
5635 | metadata = None | |
|
5636 | else: | |
|
5637 | value = opObj.getParameterValue(parameterName='metadatafile') | |
|
5638 | metadata = str(value) | |
|
5639 | self.bufferSpectraHeis("Output", "Metadata", metadata) | |
|
5640 | ||
|
4144 | def removeFTPProcUnitView(self): | |
|
4145 | ||
|
5641 | 4146 | projectObj = self.getSelectedProjectObj() |
|
5642 |
|
|
|
4147 | procUnitConfObj = projectObj.getProcUnitObjByName(name="SendToServer") | |
|
4148 | ||
|
4149 | self.__ftpProcUnitAdded = False | |
|
4150 | self.__ftpProcUnitId = None | |
|
5643 | 4151 | |
|
5644 |
if |
|
|
5645 | ||
|
5646 | opObj = ftpProcUnitConfObj.getOperationObj(name='run') | |
|
5647 | ||
|
5648 | server = opObj.getParameterValue(parameterName='server') | |
|
5649 | folder = opObj.getParameterValue(parameterName='folder') | |
|
5650 | username = opObj.getParameterValue(parameterName='username') | |
|
5651 | password = opObj.getParameterValue(parameterName='password') | |
|
5652 | ftp_wei = opObj.getParameterValue(parameterName='ftp_wei') | |
|
5653 | exp_code = opObj.getParameterValue(parameterName='exp_code') | |
|
5654 | sub_exp_code = opObj.getParameterValue(parameterName='sub_exp_code') | |
|
5655 | plot_pos = opObj.getParameterValue(parameterName='plot_pos') | |
|
5656 | localfolder = opObj.getParameterValue(parameterName='localfolder') | |
|
5657 | ||
|
5658 | self.bufferSpectraHeis("FTP", "Server", server) | |
|
5659 | self.bufferSpectraHeis("FTP", "Remote folder", folder) | |
|
5660 | self.bufferSpectraHeis("FTP", "Local folder", localfolder) | |
|
5661 | self.bufferSpectraHeis("FTP", "Username", username) | |
|
5662 | self.bufferSpectraHeis("FTP", "Password", '*'*len(password)) | |
|
5663 | self.bufferSpectraHeis("FTP", "Ftp_wei", ftp_wei) | |
|
5664 | self.bufferSpectraHeis("FTP", "Exp_code", exp_code) | |
|
5665 | self.bufferSpectraHeis("FTP", "Sub_exp_code", sub_exp_code) | |
|
5666 | self.bufferSpectraHeis("FTP", "Plot_pos", plot_pos) | |
|
4152 | if not procUnitConfObj: | |
|
4153 | return | |
|
5667 | 4154 | |
|
5668 | # set model PU Properties | |
|
4155 | projectObj.removeProcUnit(procUnitConfObj.getId()) | |
|
4156 | ||
|
4157 | if procUnitConfObj.getId() not in self.__puObjDict.keys(): | |
|
4158 | return | |
|
5669 | 4159 | |
|
4160 | self.__puObjDict.pop(procUnitConfObj.getId()) | |
|
4161 | ||
|
4162 | def showPUinitView(self): | |
|
5670 | 4163 | self.propertiesModel = TreeModel() |
|
5671 | self.propertiesModel.showProperties(self.specHeisProperCaracteristica, self.specHeisProperPrincipal, self.specHeisProperDescripcion) | |
|
5672 | ||
|
4164 | self.propertiesModel.initPUVoltageView() | |
|
5673 | 4165 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
5674 | 4166 | self.treeProjectProperties.expandAll() |
|
5675 | 4167 | self.treeProjectProperties.allColumnsShowFocus() |
|
5676 | self.treeProjectProperties.resizeColumnToContents(0) | |
|
5677 | 4168 | self.treeProjectProperties.resizeColumnToContents(1) |
|
5678 | ||
|
5679 | self.specHeisProperCaracteristica = [] | |
|
5680 | self.specHeisProperDescripcion = [] | |
|
5681 | self.specHeisProperPrincipal = [] | |
|
5682 | ||
|
5683 | ||
|
5684 | def showWr_Period(self, puObj, opObj, nameplotop): | |
|
5685 | parmObj = opObj.getParameterObj(parameterName='wr_period') | |
|
5686 | if parmObj == None: | |
|
5687 | wr_period = None | |
|
5688 | else: | |
|
5689 | value = opObj.getParameterValue(parameterName='wr_period') | |
|
5690 | wr_period = str(value) | |
|
5691 | if puObj.datatype == "Spectra": | |
|
5692 | self.bufferSpectra(nameplotop, "wr_period", wr_period) | |
|
5693 | if puObj.datatype == "SpectraHeis": | |
|
5694 | self.bufferSpectraHeis(nameplotop, "wr_period", wr_period) | |
|
5695 | ||
|
4169 | ||
|
5696 | 4170 | def saveFTPvalues(self, opObj): |
|
5697 | 4171 | |
|
5698 | 4172 | parmObj = opObj.getParameterObj(parameterName="server") |
|
5699 | 4173 | if parmObj == None: |
|
5700 | 4174 | server = 'jro-app.igp.gob.pe' |
|
5701 | 4175 | else: |
|
5702 | 4176 | server = opObj.getParameterValue(parameterName='server') |
|
5703 | 4177 | |
|
5704 | 4178 | parmObj = opObj.getParameterObj(parameterName="folder") |
|
5705 | 4179 | if parmObj == None: |
|
5706 | 4180 | folder = '/home/wmaster/graficos' |
|
5707 | 4181 | else: |
|
5708 | 4182 | folder = opObj.getParameterValue(parameterName='folder') |
|
5709 | 4183 | |
|
5710 | 4184 | parmObj = opObj.getParameterObj(parameterName="username") |
|
5711 | 4185 | if parmObj == None: |
|
5712 | 4186 | username = 'wmaster' |
|
5713 | 4187 | else: |
|
5714 | 4188 | username = opObj.getParameterValue(parameterName='username') |
|
5715 | 4189 | |
|
5716 | 4190 | parmObj = opObj.getParameterObj(parameterName="password") |
|
5717 | 4191 | if parmObj == None: |
|
5718 | 4192 | password = 'mst2010vhf' |
|
5719 | 4193 | else: |
|
5720 | 4194 | password = opObj.getParameterValue(parameterName='password') |
|
5721 | 4195 | |
|
5722 | 4196 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
5723 | 4197 | if parmObj == None: |
|
5724 | 4198 | ftp_wei = '0' |
|
5725 | 4199 | else: |
|
5726 | 4200 | ftp_wei = opObj.getParameterValue(parameterName='ftp_wei') |
|
5727 | 4201 | |
|
5728 | 4202 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
5729 | 4203 | if parmObj == None: |
|
5730 | 4204 | exp_code = '0' |
|
5731 | 4205 | else: |
|
5732 | 4206 | exp_code = opObj.getParameterValue(parameterName='exp_code') |
|
5733 | 4207 | |
|
5734 | 4208 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
5735 | 4209 | if parmObj == None: |
|
5736 | 4210 | sub_exp_code = '0' |
|
5737 | 4211 | else: |
|
5738 | 4212 | sub_exp_code = opObj.getParameterValue(parameterName='sub_exp_code') |
|
5739 | 4213 | |
|
5740 | 4214 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
5741 | 4215 | if parmObj == None: |
|
5742 | 4216 | plot_pos = '0' |
|
5743 | 4217 | else: |
|
5744 | 4218 | plot_pos = opObj.getParameterValue(parameterName='plot_pos') |
|
5745 | 4219 | |
|
5746 | 4220 | parmObj = opObj.getParameterObj(parameterName="localfolder") |
|
5747 | 4221 | if parmObj == None: |
|
5748 | 4222 | localfolder = None |
|
5749 | 4223 | else: |
|
5750 | 4224 | localfolder = opObj.getParameterValue(parameterName='localfolder') |
|
5751 | 4225 | |
|
5752 | 4226 | parmObj = opObj.getParameterObj(parameterName="extension") |
|
5753 | 4227 | if parmObj == None: |
|
5754 | 4228 | extension = None |
|
5755 | 4229 | else: |
|
5756 | 4230 | extension = opObj.getParameterValue(parameterName='extension') |
|
5757 | 4231 | |
|
5758 | 4232 | self.temporalFTP.save(server, folder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos, |
|
5759 | 4233 | localfolder=localfolder, |
|
5760 | 4234 | extension=extension) |
|
5761 | 4235 | |
|
5762 | 4236 | def addProject2ProjectExplorer(self, id, name): |
|
5763 | 4237 | |
|
5764 | 4238 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
5765 | 4239 | self.parentItem = self.projectExplorerModel.invisibleRootItem() |
|
5766 | 4240 | self.parentItem.appendRow(itemTree) |
|
5767 | 4241 | self.parentItem = itemTree |
|
5768 | 4242 | self.projectExplorerTree.setCurrentIndex(self.parentItem.index()) |
|
5769 | 4243 | |
|
5770 | 4244 | self.selectedItemTree = itemTree |
|
5771 | 4245 | |
|
5772 | 4246 | self.__itemTreeDict[id] = itemTree |
|
5773 | 4247 | |
|
5774 | 4248 | def addPU2ProjectExplorer(self, id, name): |
|
5775 | 4249 | # id1= round(int(id)/10.)*10 |
|
5776 | 4250 | # id= int(id) |
|
5777 | 4251 | # id=id-id1 |
|
5778 | 4252 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
5779 | 4253 | |
|
5780 | 4254 | self.parentItem = self.selectedItemTree |
|
5781 | 4255 | self.parentItem.appendRow(itemTree) |
|
5782 | 4256 | self.projectExplorerTree.expandAll() |
|
5783 | 4257 | self.parentItem = itemTree |
|
5784 | 4258 | self.projectExplorerTree.setCurrentIndex(self.parentItem.index()) |
|
5785 | 4259 | |
|
5786 | 4260 | self.selectedItemTree = itemTree |
|
5787 | 4261 | |
|
5788 | 4262 | self.__itemTreeDict[id] = itemTree |
|
5789 | 4263 | |
|
5790 | 4264 | def addPU2PELoadXML(self, id, name, inputId): |
|
5791 | 4265 | |
|
5792 | 4266 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
5793 | 4267 | |
|
5794 | 4268 | if self.__itemTreeDict.has_key(inputId): |
|
5795 | 4269 | self.parentItem = self.__itemTreeDict[inputId] |
|
5796 | 4270 | else: |
|
5797 | 4271 | #If parent is a Reader object |
|
5798 | 4272 | self.parentItem = self.__itemTreeDict[inputId[:-1]] |
|
5799 | 4273 | |
|
5800 | 4274 | self.parentItem.appendRow(itemTree) |
|
5801 | 4275 | self.projectExplorerTree.expandAll() |
|
5802 | 4276 | self.parentItem = itemTree |
|
5803 | 4277 | self.projectExplorerTree.setCurrentIndex(self.parentItem.index()) |
|
5804 | 4278 | |
|
5805 | 4279 | self.selectedItemTree = itemTree |
|
5806 | 4280 | |
|
5807 | 4281 | self.__itemTreeDict[id] = itemTree |
|
5808 | 4282 | # print "stop" |
|
5809 | 4283 | |
|
5810 | 4284 | def getSelectedProjectObj(self): |
|
5811 | 4285 | """ |
|
5812 | 4286 | Return the current project object selected. If a processing unit is |
|
5813 | 4287 | actually selected this function returns associated project. |
|
5814 | 4288 | |
|
5815 | 4289 | None if any project or processing unit is selected |
|
5816 | 4290 | """ |
|
5817 | 4291 | for key in self.__itemTreeDict.keys(): |
|
5818 | 4292 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
5819 | 4293 | continue |
|
5820 | 4294 | |
|
5821 | 4295 | if self.__projectObjDict.has_key(key): |
|
5822 | 4296 | projectObj = self.__projectObjDict[key] |
|
5823 | 4297 | return projectObj |
|
5824 | 4298 | |
|
5825 | 4299 | puObj = self.__puObjDict[key] |
|
5826 | 4300 | |
|
5827 | 4301 | if puObj.parentId == None: |
|
5828 | 4302 | projectId = puObj.getId()[0] |
|
5829 | 4303 | else: |
|
5830 | 4304 | projectId = puObj.parentId |
|
5831 | 4305 | |
|
5832 | 4306 | projectObj = self.__projectObjDict[projectId] |
|
5833 | 4307 | return projectObj |
|
5834 | 4308 | |
|
5835 | 4309 | return None |
|
5836 | 4310 | |
|
5837 | 4311 | def getSelectedItemObj(self): |
|
5838 | 4312 | """ |
|
5839 | 4313 | Return the current project or processing unit object selected |
|
5840 | 4314 | |
|
5841 | 4315 | None if any project or processing unit is selected |
|
5842 | 4316 | """ |
|
5843 | 4317 | for key in self.__itemTreeDict.keys(): |
|
5844 | 4318 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
5845 | 4319 | continue |
|
5846 | 4320 | |
|
5847 | 4321 | if self.__projectObjDict.has_key(key) == True: |
|
5848 | 4322 | fatherObj = self.__projectObjDict[key] |
|
5849 | 4323 | else: |
|
5850 | 4324 | fatherObj = self.__puObjDict[key] |
|
5851 | 4325 | |
|
5852 | 4326 | return fatherObj |
|
5853 | 4327 | |
|
5854 | 4328 | return None |
|
5855 | 4329 | |
|
5856 | 4330 | def _WarningWindow(self, text, information): |
|
5857 | 4331 | |
|
5858 | 4332 | msgBox = QtGui.QMessageBox() |
|
5859 | 4333 | msgBox.setText(text) |
|
5860 | 4334 | msgBox.setInformativeText(information) |
|
5861 | 4335 | msgBox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) |
|
5862 | 4336 | msgBox.setDefaultButton(QtGui.QMessageBox.Ok) |
|
5863 | 4337 | ret = msgBox.exec_() |
|
5864 | 4338 | |
|
5865 | 4339 | answer = False |
|
5866 | 4340 | |
|
5867 | 4341 | if ret == QtGui.QMessageBox.Ok: |
|
5868 | 4342 | answer = True |
|
5869 | 4343 | |
|
5870 | 4344 | return answer |
|
5871 | 4345 | |
|
5872 | 4346 | def __getNewProjectId(self): |
|
5873 | 4347 | |
|
5874 | 4348 | loadProject = False |
|
5875 | 4349 | |
|
5876 | 4350 | for thisId in range(1,10): |
|
5877 | 4351 | newId = str(thisId) |
|
5878 | 4352 | if newId in self.__projectObjDict.keys(): |
|
5879 | 4353 | continue |
|
5880 | 4354 | |
|
5881 | 4355 | loadProject = True |
|
5882 | 4356 | projectId = newId |
|
5883 | 4357 | break |
|
5884 | 4358 | |
|
5885 | 4359 | if not loadProject: |
|
5886 | 4360 | self.console.clear() |
|
5887 | 4361 | self.console.append("The maximum number of projects has been loaded, a new project can not be loaded") |
|
5888 | 4362 | return None |
|
5889 | 4363 | |
|
5890 | 4364 | return projectId |
|
5891 | 4365 | |
|
5892 | 4366 | def openProject(self): |
|
5893 | 4367 | |
|
5894 | 4368 | self.actionStart.setEnabled(False) |
|
5895 | 4369 | self.actionStarToolbar.setEnabled(False) |
|
5896 | 4370 | |
|
5897 | 4371 | self.create = False |
|
5898 | 4372 | self.frame_2.setEnabled(True) |
|
5899 | 4373 | |
|
5900 | 4374 | # print self.dir |
|
5901 | 4375 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
5902 | 4376 | |
|
5903 | 4377 | projectObjLoad = Project() |
|
5904 | 4378 | |
|
5905 | 4379 | try: |
|
5906 | 4380 | projectObjLoad.readXml(filename) |
|
5907 | 4381 | except: |
|
5908 | 4382 | self.console.clear() |
|
5909 | 4383 | self.console.append("The selected xml file could not be loaded ...") |
|
5910 | 4384 | return 0 |
|
5911 | 4385 | |
|
5912 | 4386 | self.refreshProjectWindow2(projectObjLoad) |
|
5913 | 4387 | self.refreshProjectProperties(projectObjLoad) |
|
5914 | 4388 | |
|
5915 | 4389 | projectId = projectObjLoad.id |
|
5916 | 4390 | |
|
5917 | 4391 | if projectId in self.__projectObjDict.keys(): |
|
5918 | 4392 | |
|
5919 | 4393 | # answer = self._WarningWindow("You already have a project loaded with the same Id", |
|
5920 | 4394 | # "Do you want to load the file anyway?") |
|
5921 | 4395 | # if not answer: |
|
5922 | 4396 | # return |
|
5923 | 4397 | |
|
5924 | 4398 | projectId = self.__getNewProjectId() |
|
5925 | 4399 | |
|
5926 | 4400 | if not projectId: |
|
5927 | 4401 | return |
|
5928 | 4402 | |
|
5929 | 4403 | projectObjLoad.updateId(projectId) |
|
5930 | 4404 | |
|
5931 | 4405 | self.__projectObjDict[projectId] = projectObjLoad |
|
5932 | 4406 | |
|
5933 | 4407 | self.addProject2ProjectExplorer(id=projectId, name=projectObjLoad.name) |
|
5934 | 4408 | |
|
5935 | 4409 | self.tabWidgetProject.setEnabled(True) |
|
5936 | 4410 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
5937 | 4411 | # Disable tabProject after finish the creation |
|
5938 | 4412 | self.tabProject.setEnabled(True) |
|
5939 | 4413 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) |
|
5940 | 4414 | |
|
5941 | 4415 | for puId, puObj in puObjorderList.items(): |
|
5942 | 4416 | |
|
5943 | 4417 | self.__puObjDict[puId] = puObj |
|
5944 | 4418 | |
|
5945 | 4419 | if puObj.name == "SendToServer": |
|
5946 | 4420 | self.__ftpProcUnitAdded = True |
|
5947 | 4421 | self.__ftpProcUnitId = puObj.getId() |
|
5948 | 4422 | |
|
5949 | 4423 | opObj = puObj.getOperationObj(name="run") |
|
5950 | 4424 | self.saveFTPvalues(opObj) |
|
5951 | 4425 | |
|
5952 | 4426 | if puObj.inputId == '0': |
|
5953 | 4427 | continue |
|
5954 | 4428 | |
|
5955 | 4429 | self.addPU2PELoadXML(id=puId , name=puObj.datatype , inputId=puObj.inputId) |
|
5956 | 4430 | |
|
5957 | 4431 | if puObj.datatype in ("Voltage", "Spectra", "SpectraHeis"): |
|
5958 |
self.refreshPUWindow(puObj |
|
|
4432 | self.refreshPUWindow(puObj) | |
|
5959 | 4433 | self.refreshPUProperties(puObj) |
|
5960 | 4434 | self.showtabPUCreated(datatype=puObj.datatype) |
|
5961 | 4435 | |
|
5962 | 4436 | |
|
5963 | 4437 | self.console.clear() |
|
5964 | 4438 | self.console.append("The selected xml file has been loaded successfully") |
|
5965 | 4439 | |
|
5966 | 4440 | self.actionStart.setEnabled(True) |
|
5967 | 4441 | self.actionStarToolbar.setEnabled(True) |
|
5968 | 4442 | |
|
5969 | 4443 | def on_comm_updating_timer(self): |
|
5970 | 4444 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose |
|
5971 | 4445 | |
|
5972 | 4446 | if not self.__initialized: |
|
5973 | 4447 | return |
|
5974 | 4448 | |
|
5975 | 4449 | if not self.controllerObj.isAlive(): |
|
5976 | 4450 | self.stopProject() |
|
5977 | 4451 | |
|
5978 | 4452 | def playProject(self, ext=".xml", save=1): |
|
5979 | 4453 | |
|
5980 | 4454 | # self.console.clear() |
|
5981 | 4455 | projectObj = self.getSelectedProjectObj() |
|
5982 | 4456 | |
|
5983 | 4457 | if not projectObj: |
|
5984 | 4458 | print "Please select a project before pressing PLAY" |
|
5985 | 4459 | return |
|
5986 | 4460 | |
|
5987 | 4461 | if save: |
|
5988 | 4462 | filename = self.saveProject() |
|
5989 | 4463 | if filename == None: |
|
5990 | 4464 | self.console.append("Process did not initialize.") |
|
5991 | 4465 | return |
|
5992 | 4466 | else: |
|
5993 | 4467 | filename = TEMPORAL_FILE |
|
5994 | 4468 | projectObj.writeXml(filename) |
|
5995 | 4469 | |
|
5996 | 4470 | self.actionStart.setEnabled(False) |
|
5997 | 4471 | self.actionPause.setEnabled(True) |
|
5998 | 4472 | self.actionStop.setEnabled(True) |
|
5999 | 4473 | |
|
6000 | 4474 | self.actionStarToolbar.setEnabled(False) |
|
6001 | 4475 | self.actionPauseToolbar.setEnabled(True) |
|
6002 | 4476 | self.actionStopToolbar.setEnabled(True) |
|
6003 | 4477 | |
|
6004 | 4478 | self.console.append("Please Wait...") |
|
6005 | 4479 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PROCESS, filename)) |
|
6006 | 4480 | |
|
6007 | 4481 | self.controllerObj = ControllerThread(filename) |
|
6008 | 4482 | self.controllerObj.start() |
|
6009 | 4483 | sleep(0.5) |
|
6010 | 4484 | self.__initialized = True |
|
6011 | 4485 | |
|
6012 | 4486 | def stopProject(self): |
|
6013 | 4487 | |
|
6014 | 4488 | self.__initialized = False |
|
6015 | 4489 | |
|
6016 | 4490 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
6017 | 4491 | self.controllerObj.stop() |
|
6018 | 4492 | |
|
6019 | 4493 | self.actionStart.setEnabled(True) |
|
6020 | 4494 | self.actionPause.setEnabled(False) |
|
6021 | 4495 | self.actionStop.setEnabled(False) |
|
6022 | 4496 | |
|
6023 | 4497 | self.actionStarToolbar.setEnabled(True) |
|
6024 | 4498 | self.actionPauseToolbar.setEnabled(False) |
|
6025 | 4499 | self.actionStopToolbar.setEnabled(False) |
|
6026 | 4500 | |
|
6027 | 4501 | self.restorePauseIcon() |
|
6028 | 4502 | |
|
6029 | 4503 | def pauseProject(self): |
|
6030 | 4504 | |
|
6031 | 4505 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) |
|
6032 | 4506 | self.controllerObj.pause() |
|
6033 | 4507 | |
|
6034 | 4508 | self.actionStart.setEnabled(False) |
|
6035 | 4509 | self.actionPause.setEnabled(True) |
|
6036 | 4510 | self.actionStop.setEnabled(True) |
|
6037 | 4511 | |
|
6038 | 4512 | self.actionStarToolbar.setEnabled(False) |
|
6039 | 4513 | self.actionPauseToolbar.setEnabled(True) |
|
6040 | 4514 | self.actionStopToolbar.setEnabled(True) |
|
6041 | 4515 | |
|
6042 | 4516 | def saveProject(self, filename=None): |
|
6043 | 4517 | |
|
6044 | 4518 | self.actionStart.setEnabled(False) |
|
6045 | 4519 | self.actionStarToolbar.setEnabled(False) |
|
6046 | 4520 | |
|
6047 | 4521 | projectObj = self.getSelectedProjectObj() |
|
6048 | 4522 | self.refreshGraphicsId() |
|
6049 | 4523 | |
|
6050 | 4524 | sts = True |
|
6051 | 4525 | selectedItemObj = self.getSelectedItemObj() |
|
6052 | 4526 | |
|
6053 | 4527 | #A Processing Unit has been selected |
|
6054 | 4528 | if projectObj == selectedItemObj: |
|
6055 | 4529 | if not self.on_proOk_clicked(): |
|
6056 | 4530 | return None |
|
6057 | 4531 | |
|
6058 | 4532 | #A Processing Unit has been selected |
|
6059 | 4533 | if projectObj != selectedItemObj: |
|
6060 | 4534 | puObj = selectedItemObj |
|
6061 | 4535 | |
|
6062 | 4536 | if puObj.name == 'VoltageProc': |
|
6063 | 4537 | sts = self.on_volOpOk_clicked() |
|
6064 | 4538 | if puObj.name == 'SpectraProc': |
|
6065 | 4539 | sts = self.on_specOpOk_clicked() |
|
6066 | 4540 | if puObj.name == 'SpectraHeisProc': |
|
6067 | 4541 | sts = self.on_specHeisOpOk_clicked() |
|
6068 | 4542 | |
|
6069 | 4543 | if not sts: |
|
6070 | 4544 | return None |
|
6071 | 4545 | |
|
6072 | 4546 | if not filename: |
|
6073 | 4547 | filename = os.path.join( str(self.pathWorkSpace), "%s%s" %(str(projectObj.name), '.xml') ) |
|
6074 | 4548 | |
|
6075 | 4549 | projectObj.writeXml(filename) |
|
6076 | 4550 | self.console.append("Now, you can press Start Button on the toolbar") |
|
6077 | 4551 | |
|
6078 | 4552 | self.actionStart.setEnabled(True) |
|
6079 | 4553 | self.actionStarToolbar.setEnabled(True) |
|
6080 | 4554 | |
|
6081 | 4555 | return filename |
|
6082 | 4556 | |
|
6083 | 4557 | def removeItemTreeFromProject(self): |
|
6084 | 4558 | """ |
|
6085 | 4559 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol |
|
6086 | 4560 | """ |
|
6087 | 4561 | for key in self.__itemTreeDict.keys(): |
|
6088 | 4562 | |
|
6089 | 4563 | #Check again because an item can delete multiple items (childs) |
|
6090 | 4564 | if key not in self.__itemTreeDict.keys(): |
|
6091 | 4565 | continue |
|
6092 | 4566 | |
|
6093 | 4567 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
6094 | 4568 | continue |
|
6095 | 4569 | |
|
6096 | 4570 | if self.__projectObjDict.has_key(key) == True: |
|
6097 | 4571 | |
|
6098 | 4572 | del self.__projectObjDict[key] |
|
6099 | 4573 | del self.__itemTreeDict[key] |
|
6100 | 4574 | |
|
6101 | 4575 | else: |
|
6102 | 4576 | puObj = self.__puObjDict[key] |
|
6103 | 4577 | idProjectParent = puObj.parentId |
|
6104 | 4578 | projectObj = self.__projectObjDict[idProjectParent] |
|
6105 | 4579 | |
|
6106 | 4580 | del self.__puObjDict[key] |
|
6107 | 4581 | del self.__itemTreeDict[key] |
|
6108 | 4582 | del projectObj.procUnitConfObjDict[key] |
|
6109 | 4583 | |
|
6110 | 4584 | for key in projectObj.procUnitConfObjDict.keys(): |
|
6111 | 4585 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): |
|
6112 | 4586 | continue |
|
6113 | 4587 | del self.__puObjDict[projectObj.procUnitConfObjDict[key].getId()] |
|
6114 | 4588 | del self.__itemTreeDict[projectObj.procUnitConfObjDict[key].getId()] |
|
6115 | 4589 | del projectObj.procUnitConfObjDict[key] |
|
6116 | 4590 | # print projectObj.procUnitConfObjDict |
|
6117 | 4591 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict |
|
6118 | ||
|
6119 | def getParmsFromProjectWindow(self): | |
|
6120 | """ | |
|
6121 | Return Inputs Project: | |
|
6122 | - id | |
|
6123 | - project_name | |
|
6124 | - datatype | |
|
6125 | - ext | |
|
6126 | - data_path | |
|
6127 | - readmode | |
|
6128 | - delay | |
|
6129 | - set | |
|
6130 | - walk | |
|
6131 | """ | |
|
6132 | project_name = str(self.proName.text()) | |
|
6133 | try: | |
|
6134 | name = str(self.proName.text()) | |
|
6135 | except: | |
|
6136 | self.console.clear() | |
|
6137 | self.console.append("Please Write a name") | |
|
6138 | return 0 | |
|
6139 | ||
|
6140 | desc = str(self.proDescription.toPlainText()) | |
|
6141 | datatype = str(self.proComDataType.currentText()) | |
|
6142 | data_path = str(self.proDataPath.text()) | |
|
6143 | if not os.path.exists(data_path): | |
|
6144 | self.proOk.setEnabled(False) | |
|
6145 | self.console.clear() | |
|
6146 | self.console.append("Write a correct a path") | |
|
6147 | return | |
|
6148 | ||
|
6149 | online = int(self.online) | |
|
6150 | if online == 0: | |
|
6151 | delay = 0 | |
|
6152 | set = 0 | |
|
6153 | else: | |
|
6154 | delay = self.proDelay.text() | |
|
6155 | try: | |
|
6156 | delay = int(self.proDelay.text()) | |
|
6157 | except: | |
|
6158 | self.console.clear() | |
|
6159 | self.console.append("Please Write a number for delay") | |
|
6160 | return 0 | |
|
6161 | 4592 | |
|
6162 | set = self.proSet.text() | |
|
6163 | try: | |
|
6164 | set = int(self.proSet.text()) | |
|
6165 | except: | |
|
6166 | set = None | |
|
6167 | ||
|
6168 | ||
|
6169 | walk = int(self.walk) | |
|
6170 | starDate = str(self.proComStartDate.currentText()) | |
|
6171 | endDate = str(self.proComEndDate.currentText()) | |
|
6172 | reloj1 = self.proStartTime.time() | |
|
6173 | reloj2 = self.proEndTime.time() | |
|
6174 | startTime = str(reloj1.hour()) + ":" + str(reloj1.minute()) + ":" + str(reloj1.second()) | |
|
6175 | endTime = str(reloj2.hour()) + ":" + str(reloj2.minute()) + ":" + str(reloj2.second()) | |
|
6176 | ||
|
6177 | return project_name, desc, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk , set | |
|
6178 | ||
|
6179 | 4593 | def removefromtree(self, row): |
|
6180 | 4594 | self.parentItem.removeRow(row) |
|
6181 | 4595 | |
|
6182 | 4596 | |
|
6183 | 4597 | def setInputsProject_View(self): |
|
6184 | 4598 | |
|
6185 | 4599 | self.tabWidgetProject.setEnabled(True) |
|
6186 | 4600 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
6187 | 4601 | self.tabProject.setEnabled(True) |
|
6188 | 4602 | self.frame_2.setEnabled(False) |
|
6189 | 4603 | self.proName.clear() |
|
6190 | 4604 | self.proName.setFocus() |
|
6191 | 4605 | self.proName.setSelection(0, 0) |
|
6192 | 4606 | self.proName.setCursorPosition(0) |
|
6193 | 4607 | self.proDataType.setText('.r') |
|
6194 | 4608 | self.proDataPath.clear() |
|
6195 | 4609 | self.proComDataType.clear() |
|
6196 | 4610 | self.proComDataType.addItem("Voltage") |
|
6197 | 4611 | self.proComDataType.addItem("Spectra") |
|
6198 | 4612 | self.proComDataType.addItem("Fits") |
|
6199 | 4613 | self.proComDataType.addItem("USRP") |
|
6200 | 4614 | |
|
6201 | 4615 | self.proComStartDate.clear() |
|
6202 | 4616 | self.proComEndDate.clear() |
|
6203 | 4617 | |
|
6204 | 4618 | startTime = "00:00:00" |
|
6205 | 4619 | endTime = "23:59:59" |
|
6206 | 4620 | starlist = startTime.split(":") |
|
6207 | 4621 | endlist = endTime.split(":") |
|
6208 | 4622 | self.proDelay.setText("60") |
|
6209 | 4623 | self.proSet.setText("") |
|
6210 | 4624 | |
|
6211 | 4625 | self.labelSet.show() |
|
6212 | 4626 | self.proSet.show() |
|
6213 | 4627 | |
|
6214 | 4628 | self.labelIPPKm.hide() |
|
6215 | 4629 | self.proIPPKm.hide() |
|
6216 | 4630 | |
|
6217 | 4631 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
6218 | 4632 | self.proStartTime.setTime(self.time) |
|
6219 | 4633 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
6220 | 4634 | self.proEndTime.setTime(self.time) |
|
6221 | 4635 | self.proDescription.clear() |
|
6222 | 4636 | self.proOk.setEnabled(False) |
|
6223 | 4637 | # self.console.append("Please, Write a name Project") |
|
6224 | 4638 | # self.console.append("Introduce Project Parameters")DC |
|
6225 | 4639 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") |
|
6226 | 4640 | |
|
6227 | 4641 | def clearPUWindow(self, datatype): |
|
6228 | 4642 | |
|
6229 | 4643 | projectObjView = self.getSelectedProjectObj() |
|
6230 | 4644 | |
|
6231 | 4645 | if not projectObjView: |
|
6232 | 4646 | return |
|
6233 | 4647 | |
|
6234 | 4648 | puObj = self.getSelectedItemObj() |
|
6235 | 4649 | inputId = puObj.getInputId() |
|
6236 | 4650 | inputPUObj = projectObjView.getProcUnitObj(inputId) |
|
6237 | 4651 | |
|
6238 | 4652 | if datatype == 'Voltage': |
|
6239 | 4653 | self.volOpComChannels.setEnabled(False) |
|
6240 | 4654 | self.volOpComHeights.setEnabled(False) |
|
6241 | 4655 | self.volOpFilter.setEnabled(False) |
|
6242 | 4656 | self.volOpComProfile.setEnabled(False) |
|
6243 | 4657 | self.volOpComCode.setEnabled(False) |
|
6244 | 4658 | self.volOpCohInt.setEnabled(False) |
|
6245 | 4659 | self.volOpChannel.setEnabled(False) |
|
6246 | 4660 | self.volOpHeights.setEnabled(False) |
|
6247 | 4661 | self.volOpProfile.setEnabled(False) |
|
6248 | 4662 | self.volOpRadarfrequency.setEnabled(False) |
|
6249 | 4663 | self.volOpCebChannels.setCheckState(0) |
|
6250 | 4664 | self.volOpCebRadarfrequency.setCheckState(0) |
|
6251 | 4665 | self.volOpCebHeights.setCheckState(0) |
|
6252 | 4666 | self.volOpCebFilter.setCheckState(0) |
|
6253 | 4667 | self.volOpCebProfile.setCheckState(0) |
|
6254 | 4668 | self.volOpCebDecodification.setCheckState(0) |
|
6255 | 4669 | self.volOpCebCohInt.setCheckState(0) |
|
6256 | 4670 | |
|
6257 | 4671 | self.volOpChannel.clear() |
|
6258 | 4672 | self.volOpHeights.clear() |
|
6259 | 4673 | self.volOpProfile.clear() |
|
6260 | 4674 | self.volOpFilter.clear() |
|
6261 | 4675 | self.volOpCohInt.clear() |
|
6262 | 4676 | self.volOpRadarfrequency.clear() |
|
6263 | 4677 | |
|
6264 | 4678 | if datatype == 'Spectra': |
|
6265 | 4679 | |
|
6266 | 4680 | if inputPUObj.datatype == 'Spectra': |
|
6267 | 4681 | self.specOpnFFTpoints.setEnabled(False) |
|
6268 | 4682 | self.specOpProfiles.setEnabled(False) |
|
6269 | 4683 | self.specOpippFactor.setEnabled(False) |
|
6270 | 4684 | else: |
|
6271 | 4685 | self.specOpnFFTpoints.setEnabled(True) |
|
6272 | 4686 | self.specOpProfiles.setEnabled(True) |
|
6273 | 4687 | self.specOpippFactor.setEnabled(True) |
|
6274 | 4688 | |
|
6275 | 4689 | self.specOpCebCrossSpectra.setCheckState(0) |
|
6276 | 4690 | self.specOpCebChannel.setCheckState(0) |
|
6277 | 4691 | self.specOpCebHeights.setCheckState(0) |
|
6278 | 4692 | self.specOpCebIncoherent.setCheckState(0) |
|
6279 | 4693 | self.specOpCebRemoveDC.setCheckState(0) |
|
6280 | 4694 | self.specOpCebRemoveInt.setCheckState(0) |
|
6281 | 4695 | self.specOpCebgetNoise.setCheckState(0) |
|
6282 | 4696 | self.specOpCebRadarfrequency.setCheckState(0) |
|
6283 | 4697 | |
|
6284 | 4698 | self.specOpRadarfrequency.setEnabled(False) |
|
6285 | 4699 | self.specOppairsList.setEnabled(False) |
|
6286 | 4700 | self.specOpChannel.setEnabled(False) |
|
6287 | 4701 | self.specOpHeights.setEnabled(False) |
|
6288 | 4702 | self.specOpIncoherent.setEnabled(False) |
|
6289 | 4703 | self.specOpgetNoise.setEnabled(False) |
|
6290 | 4704 | |
|
6291 | 4705 | self.specOpRadarfrequency.clear() |
|
6292 | 4706 | self.specOpnFFTpoints.clear() |
|
6293 | 4707 | self.specOpProfiles.clear() |
|
6294 | 4708 | self.specOpippFactor.clear |
|
6295 | 4709 | self.specOppairsList.clear() |
|
6296 | 4710 | self.specOpChannel.clear() |
|
6297 | 4711 | self.specOpHeights.clear() |
|
6298 | 4712 | self.specOpIncoherent.clear() |
|
6299 | 4713 | self.specOpgetNoise.clear() |
|
6300 | 4714 | |
|
6301 | 4715 | self.specGraphCebSpectraplot.setCheckState(0) |
|
6302 | 4716 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
6303 | 4717 | self.specGraphCebRTIplot.setCheckState(0) |
|
6304 | 4718 | self.specGraphCebRTInoise.setCheckState(0) |
|
6305 | 4719 | self.specGraphCebCoherencmap.setCheckState(0) |
|
6306 | 4720 | self.specGraphPowerprofile.setCheckState(0) |
|
6307 | 4721 | |
|
6308 | 4722 | self.specGraphSaveSpectra.setCheckState(0) |
|
6309 | 4723 | self.specGraphSaveCross.setCheckState(0) |
|
6310 | 4724 | self.specGraphSaveRTIplot.setCheckState(0) |
|
6311 | 4725 | self.specGraphSaveRTInoise.setCheckState(0) |
|
6312 | 4726 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
6313 | 4727 | self.specGraphSavePowerprofile.setCheckState(0) |
|
6314 | 4728 | |
|
6315 | 4729 | self.specGraphftpRTIplot.setCheckState(0) |
|
6316 | 4730 | self.specGraphftpRTInoise.setCheckState(0) |
|
6317 | 4731 | self.specGraphftpCoherencemap.setCheckState(0) |
|
6318 | 4732 | |
|
6319 | 4733 | self.specGraphPath.clear() |
|
6320 | 4734 | self.specGraphPrefix.clear() |
|
6321 | 4735 | |
|
6322 | 4736 | self.specGgraphftpratio.clear() |
|
6323 | 4737 | |
|
6324 | 4738 | self.specGgraphChannelList.clear() |
|
6325 | 4739 | self.specGgraphFreq.clear() |
|
6326 | 4740 | self.specGgraphHeight.clear() |
|
6327 | 4741 | self.specGgraphDbsrange.clear() |
|
6328 | 4742 | self.specGgraphmagnitud.clear() |
|
6329 | 4743 | self.specGgraphTminTmax.clear() |
|
6330 | 4744 | self.specGgraphTimeRange.clear() |
|
6331 | 4745 | |
|
6332 | 4746 | if datatype == 'SpectraHeis': |
|
6333 | 4747 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
6334 | 4748 | self.specHeisOpIncoherent.setEnabled(False) |
|
6335 | 4749 | self.specHeisOpIncoherent.clear() |
|
6336 | 4750 | |
|
6337 | 4751 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
6338 | 4752 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
6339 | 4753 | |
|
6340 | 4754 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
6341 | 4755 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
6342 | 4756 | |
|
6343 | 4757 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
6344 | 4758 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
6345 | 4759 | |
|
6346 | 4760 | self.specHeisGraphPath.clear() |
|
6347 | 4761 | self.specHeisGraphPrefix.clear() |
|
6348 | 4762 | self.specHeisGgraphChannelList.clear() |
|
6349 | 4763 | self.specHeisGgraphXminXmax.clear() |
|
6350 | 4764 | self.specHeisGgraphYminYmax.clear() |
|
6351 | 4765 | self.specHeisGgraphTminTmax.clear() |
|
6352 | 4766 | self.specHeisGgraphTimeRange.clear() |
|
6353 | 4767 | self.specHeisGgraphftpratio.clear() |
|
6354 | 4768 | |
|
6355 | 4769 | |
|
6356 | 4770 | |
|
6357 | 4771 | |
|
6358 | 4772 | |
|
6359 | 4773 | def showtabPUCreated(self, datatype): |
|
6360 | 4774 | if datatype == "Voltage": |
|
6361 | 4775 | self.tabVoltage.setEnabled(True) |
|
6362 | 4776 | self.tabProject.setEnabled(False) |
|
6363 | 4777 | self.tabSpectra.setEnabled(False) |
|
6364 | 4778 | self.tabCorrelation.setEnabled(False) |
|
6365 | 4779 | self.tabSpectraHeis.setEnabled(False) |
|
6366 | 4780 | self.tabWidgetProject.setCurrentWidget(self.tabVoltage) |
|
6367 | 4781 | |
|
6368 | 4782 | if datatype == "Spectra": |
|
6369 | 4783 | self.tabVoltage.setEnabled(False) |
|
6370 | 4784 | self.tabProject.setEnabled(False) |
|
6371 | 4785 | self.tabSpectra.setEnabled(True) |
|
6372 | 4786 | self.tabCorrelation.setEnabled(False) |
|
6373 | 4787 | self.tabSpectraHeis.setEnabled(False) |
|
6374 | 4788 | self.tabWidgetProject.setCurrentWidget(self.tabSpectra) |
|
6375 | 4789 | if datatype == "SpectraHeis": |
|
6376 | 4790 | self.tabVoltage.setEnabled(False) |
|
6377 | 4791 | self.tabProject.setEnabled(False) |
|
6378 | 4792 | self.tabSpectra.setEnabled(False) |
|
6379 | 4793 | self.tabCorrelation.setEnabled(False) |
|
6380 | 4794 | self.tabSpectraHeis.setEnabled(True) |
|
6381 | 4795 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) |
|
6382 | 4796 | |
|
6383 | 4797 | def checkInputsProject(self): |
|
6384 | 4798 | """ |
|
6385 | 4799 | Check Inputs Project: |
|
6386 | 4800 | - project_name |
|
6387 | 4801 | - datatype |
|
6388 | 4802 | - ext |
|
6389 | 4803 | - data_path |
|
6390 | 4804 | - readmode |
|
6391 | 4805 | - delay |
|
6392 | 4806 | - set |
|
6393 | 4807 | - walk |
|
6394 | 4808 | """ |
|
6395 | 4809 | parms_ok = True |
|
6396 | 4810 | project_name = str(self.proName.text()) |
|
6397 | 4811 | if project_name == '' or project_name == None: |
|
6398 | 4812 | outputstr = "Enter the Project Name" |
|
6399 | 4813 | self.console.append(outputstr) |
|
6400 | 4814 | parms_ok = False |
|
6401 | 4815 | project_name = None |
|
6402 | 4816 | |
|
6403 | 4817 | datatype = str(self.proComDataType.currentText()) |
|
6404 | 4818 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): |
|
6405 | 4819 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype |
|
6406 | 4820 | self.console.append(outputstr) |
|
6407 | 4821 | parms_ok = False |
|
6408 | 4822 | datatype = None |
|
6409 | 4823 | |
|
6410 | 4824 | ext = str(self.proDataType.text()) |
|
6411 | 4825 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): |
|
6412 | 4826 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" |
|
6413 | 4827 | self.console.append(outputstr) |
|
6414 | 4828 | parms_ok = False |
|
6415 | 4829 | ext = None |
|
6416 | 4830 | |
|
6417 | 4831 | data_path = str(self.proDataPath.text()) |
|
6418 | 4832 | |
|
6419 | 4833 | if data_path == '': |
|
6420 | 4834 | outputstr = 'Datapath is empty' |
|
6421 | 4835 | self.console.append(outputstr) |
|
6422 | 4836 | parms_ok = False |
|
6423 | 4837 | data_path = None |
|
6424 | 4838 | |
|
6425 | 4839 | if data_path != None: |
|
6426 | 4840 | if not os.path.isdir(data_path): |
|
6427 | 4841 | outputstr = 'Datapath:%s does not exists' % data_path |
|
6428 | 4842 | self.console.append(outputstr) |
|
6429 | 4843 | parms_ok = False |
|
6430 | 4844 | data_path = None |
|
6431 | 4845 | |
|
6432 | 4846 | read_mode = str(self.proComReadMode.currentText()) |
|
6433 | 4847 | if not(read_mode in ['Online', 'Offline']): |
|
6434 | 4848 | outputstr = 'Read Mode: %s, this must be either Online or Offline' % read_mode |
|
6435 | 4849 | self.console.append(outputstr) |
|
6436 | 4850 | parms_ok = False |
|
6437 | 4851 | read_mode = None |
|
6438 | 4852 | |
|
6439 | 4853 | try: |
|
6440 | 4854 | delay = int(str(self.proDelay.text())) |
|
6441 | 4855 | except: |
|
6442 | 4856 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) |
|
6443 | 4857 | self.console.append(outputstr) |
|
6444 | 4858 | # parms_ok = False |
|
6445 | 4859 | delay = None |
|
6446 | 4860 | |
|
6447 | 4861 | try: |
|
6448 | 4862 | set = int(str(self.proSet.text())) |
|
6449 | 4863 | except: |
|
6450 | 4864 | # outputstr = 'Set: %s, this must be a integer number' % str(self.proName.text()) |
|
6451 | 4865 | # self.console.append(outputstr) |
|
6452 | 4866 | # parms_ok = False |
|
6453 | 4867 | set = None |
|
6454 | 4868 | |
|
6455 | 4869 | walk_str = str(self.proComWalk.currentText()) |
|
6456 | 4870 | if walk_str == 'On Files': |
|
6457 | 4871 | walk = 0 |
|
6458 | 4872 | elif walk_str == 'On Folder': |
|
6459 | 4873 | walk = 1 |
|
6460 | 4874 | else: |
|
6461 | 4875 | outputstr = 'Walk: %s, this must be either On Files or On Folders' % walk_str |
|
6462 | 4876 | self.console.append(outputstr) |
|
6463 | 4877 | parms_ok = False |
|
6464 | 4878 | walk = None |
|
6465 | 4879 | |
|
6466 | 4880 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set |
|
6467 | 4881 | |
|
6468 | 4882 | def checkInputsPUSave(self, datatype): |
|
6469 | 4883 | """ |
|
6470 | 4884 | Check Inputs Spectra Save: |
|
6471 | 4885 | - path |
|
6472 | 4886 | - blocks Per File |
|
6473 | 4887 | - sufix |
|
6474 | 4888 | - dataformat |
|
6475 | 4889 | """ |
|
6476 | 4890 | parms_ok = True |
|
6477 | 4891 | |
|
6478 | 4892 | if datatype == "Voltage": |
|
6479 | 4893 | output_path = str(self.volOutputPath.text()) |
|
6480 | 4894 | blocksperfile = str(self.volOutputblocksperfile.text()) |
|
6481 | 4895 | profilesperblock = str(self.volOutputprofilesperblock.text()) |
|
6482 | 4896 | |
|
6483 | 4897 | if datatype == "Spectra": |
|
6484 | 4898 | output_path = str(self.specOutputPath.text()) |
|
6485 | 4899 | blocksperfile = str(self.specOutputblocksperfile.text()) |
|
6486 | 4900 | profilesperblock = str(self.specOutputprofileperblock.text()) |
|
6487 | 4901 | |
|
6488 | 4902 | if datatype == "SpectraHeis": |
|
6489 | 4903 | output_path = str(self.specHeisOutputPath.text()) |
|
6490 | 4904 | blocksperfile = str(self.specHeisOutputblocksperfile.text()) |
|
6491 | 4905 | metada = str(self.specHeisOutputMetada.text()) |
|
6492 | 4906 | |
|
6493 | 4907 | if output_path == '': |
|
6494 | 4908 | outputstr = 'Outputpath is empty' |
|
6495 | 4909 | self.console.append(outputstr) |
|
6496 | 4910 | parms_ok = False |
|
6497 | 4911 | data_path = None |
|
6498 | 4912 | |
|
6499 | 4913 | if output_path != None: |
|
6500 | 4914 | if not os.path.exists(output_path): |
|
6501 | 4915 | outputstr = 'OutputPath:%s does not exists' % output_path |
|
6502 | 4916 | self.console.append(outputstr) |
|
6503 | 4917 | parms_ok = False |
|
6504 | 4918 | output_path = None |
|
6505 | 4919 | |
|
6506 | 4920 | |
|
6507 | 4921 | try: |
|
6508 | 4922 | profilesperblock = int(profilesperblock) |
|
6509 | 4923 | except: |
|
6510 | 4924 | if datatype == "Voltage": |
|
6511 | 4925 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.volOutputprofilesperblock.text()) |
|
6512 | 4926 | self.console.append(outputstr) |
|
6513 | 4927 | parms_ok = False |
|
6514 | 4928 | profilesperblock = None |
|
6515 | 4929 | |
|
6516 | 4930 | elif datatype == "Spectra": |
|
6517 | 4931 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.specOutputprofileperblock.text()) |
|
6518 | 4932 | self.console.append(outputstr) |
|
6519 | 4933 | parms_ok = False |
|
6520 | 4934 | profilesperblock = None |
|
6521 | 4935 | |
|
6522 | 4936 | try: |
|
6523 | 4937 | blocksperfile = int(blocksperfile) |
|
6524 | 4938 | except: |
|
6525 | 4939 | if datatype == "Voltage": |
|
6526 | 4940 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.volOutputblocksperfile.text()) |
|
6527 | 4941 | elif datatype == "Spectra": |
|
6528 | 4942 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specOutputblocksperfile.text()) |
|
6529 | 4943 | elif datatype == "SpectraHeis": |
|
6530 | 4944 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specHeisOutputblocksperfile.text()) |
|
6531 | 4945 | |
|
6532 | 4946 | self.console.append(outputstr) |
|
6533 | 4947 | parms_ok = False |
|
6534 | 4948 | blocksperfile = None |
|
6535 | 4949 | |
|
6536 | 4950 | if datatype == "SpectraHeis": |
|
6537 | 4951 | if metada == '': |
|
6538 | 4952 | outputstr = 'Choose metada file' |
|
6539 | 4953 | self.console.append(outputstr) |
|
6540 | 4954 | parms_ok = False |
|
6541 | 4955 | if metada != None: |
|
6542 | 4956 | if not os.path.isfile(metada): |
|
6543 | 4957 | outputstr = 'Metadata:%s does not exists' % metada |
|
6544 | 4958 | self.console.append(outputstr) |
|
6545 | 4959 | parms_ok = False |
|
6546 | 4960 | output_path = None |
|
6547 | 4961 | |
|
6548 | 4962 | if datatype == "Voltage": |
|
6549 | 4963 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
6550 | 4964 | |
|
6551 | 4965 | |
|
6552 | 4966 | if datatype == "Spectra": |
|
6553 | 4967 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
6554 | 4968 | |
|
6555 | 4969 | |
|
6556 | 4970 | if datatype == "SpectraHeis": |
|
6557 | 4971 | return parms_ok, output_path, blocksperfile, metada |
|
6558 | 4972 | |
|
6559 | def searchData(self, data_path, ext, walk, expLabel=''): | |
|
6560 | dateList = [] | |
|
6561 | fileList = [] | |
|
6562 | ||
|
6563 | if not os.path.exists(data_path): | |
|
6564 | return None | |
|
6565 | ||
|
6566 | if walk == 0: | |
|
6567 | files = os.listdir(data_path) | |
|
6568 | for thisFile in files: | |
|
6569 | thisExt = os.path.splitext(thisFile)[-1] | |
|
6570 | if thisExt == ext: | |
|
6571 | fileList.append(thisFile) | |
|
6572 | ||
|
6573 | for thisFile in fileList: | |
|
6574 | try: | |
|
6575 | year = int(thisFile[1:5]) | |
|
6576 | doy = int(thisFile[5:8]) | |
|
6577 | ||
|
6578 | date = datetime.date(year, 1, 1) + datetime.timedelta(doy - 1) | |
|
6579 | dateformat = date.strftime("%Y/%m/%d") | |
|
6580 | ||
|
6581 | if dateformat not in dateList: | |
|
6582 | dateList.append(dateformat) | |
|
6583 | except: | |
|
6584 | continue | |
|
6585 | # REVISION---------------------------------1 | |
|
6586 | if walk == 1: | |
|
6587 | ||
|
6588 | dirList = os.listdir(data_path) | |
|
6589 | ||
|
6590 | dirList.sort() | |
|
6591 | ||
|
6592 | dateList = [] | |
|
6593 | ||
|
6594 | for thisDir in dirList: | |
|
6595 | ||
|
6596 | if not isRadarPath(thisDir): | |
|
6597 | self.console.clear() | |
|
6598 | self.console.append("Please, Choose the Correct Path") | |
|
6599 | self.proOk.setEnabled(False) | |
|
6600 | continue | |
|
6601 | ||
|
6602 | doypath = os.path.join(data_path, thisDir, expLabel) | |
|
6603 | if not os.path.exists(doypath): | |
|
6604 | self.console.clear() | |
|
6605 | self.console.append("Please, Choose the Correct Path") | |
|
6606 | return | |
|
6607 | files = os.listdir(doypath) | |
|
6608 | fileList = [] | |
|
6609 | ||
|
6610 | for thisFile in files: | |
|
6611 | thisExt = os.path.splitext(thisFile)[-1] | |
|
6612 | if thisExt != ext: | |
|
6613 | self.console.clear() | |
|
6614 | self.console.append("There is no datatype selected in the Path Directory") | |
|
6615 | self.proOk.setEnabled(False) | |
|
6616 | continue | |
|
6617 | ||
|
6618 | if not isRadarFile(thisFile): | |
|
6619 | self.proOk.setEnabled(False) | |
|
6620 | self.console.clear() | |
|
6621 | self.console.append("Please, Choose the Correct Path") | |
|
6622 | continue | |
|
6623 | ||
|
6624 | fileList.append(thisFile) | |
|
6625 | break | |
|
6626 | ||
|
6627 | if fileList == []: | |
|
6628 | continue | |
|
6629 | ||
|
6630 | year = int(thisDir[1:5]) | |
|
6631 | doy = int(thisDir[5:8]) | |
|
6632 | ||
|
6633 | date = datetime.date(year, 1, 1) + datetime.timedelta(doy - 1) | |
|
6634 | dateformat = date.strftime("%Y/%m/%d") | |
|
6635 | dateList.append(dateformat) | |
|
6636 | ||
|
6637 | if len(dateList) > 0: | |
|
6638 | self.proOk.setEnabled(True) | |
|
6639 | return dateList | |
|
6640 | ||
|
6641 | ||
|
6642 | # self.proOk.setEnabled(False) | |
|
6643 | return None | |
|
6644 | ||
|
6645 | 4973 | def findDatafiles(self, data_path, ext, walk, expLabel=''): |
|
6646 | 4974 | |
|
6647 | 4975 | dateList = [] |
|
6648 | 4976 | fileList = [] |
|
6649 | 4977 | |
|
6650 | 4978 | if ext == ".r": |
|
6651 | 4979 | from schainpy.model.io.jroIO_base import JRODataReader |
|
6652 | 4980 | |
|
6653 | 4981 | readerObj = JRODataReader() |
|
6654 | 4982 | dateList = readerObj.findDatafiles(path=data_path, |
|
6655 | 4983 | expLabel=expLabel, |
|
6656 | 4984 | ext=ext, |
|
6657 | 4985 | walk=walk) |
|
6658 | 4986 | |
|
6659 | 4987 | if ext == ".pdata": |
|
6660 | 4988 | from schainpy.model.io.jroIO_base import JRODataReader |
|
6661 | 4989 | |
|
6662 | 4990 | readerObj = JRODataReader() |
|
6663 | 4991 | dateList = readerObj.findDatafiles(path=data_path, |
|
6664 | 4992 | expLabel=expLabel, |
|
6665 | 4993 | ext=ext, |
|
6666 | 4994 | walk=walk) |
|
6667 | 4995 | |
|
6668 | 4996 | if ext == ".fits": |
|
6669 | 4997 | from schainpy.model.io.jroIO_base import JRODataReader |
|
6670 | 4998 | |
|
6671 | 4999 | readerObj = JRODataReader() |
|
6672 | 5000 | dateList = readerObj.findDatafiles(path=data_path, |
|
6673 | 5001 | expLabel=expLabel, |
|
6674 | 5002 | ext=ext, |
|
6675 | 5003 | walk=walk) |
|
6676 | 5004 | |
|
6677 | 5005 | if ext == ".hdf5": |
|
6678 | 5006 | from schainpy.model.io.jroIO_usrp import USRPReader |
|
6679 | 5007 | |
|
6680 | 5008 | readerObj = USRPReader() |
|
6681 | 5009 | dateList = readerObj.findDatafiles(path=data_path) |
|
6682 | 5010 | |
|
6683 | 5011 | return dateList |
|
6684 | 5012 | |
|
6685 | 5013 | def loadDays(self, data_path, ext, walk, expLabel=''): |
|
6686 | 5014 | """ |
|
6687 | 5015 | Method to loads day |
|
6688 | 5016 | """ |
|
6689 | 5017 | self.proOk.setEnabled(False) |
|
6690 | 5018 | self.dateList = [] |
|
6691 | 5019 | |
|
6692 | 5020 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) |
|
6693 | 5021 | |
|
6694 | 5022 | if not dateList: |
|
6695 | 5023 | # self.console.clear() |
|
6696 | 5024 | outputstr = "The path: %s is empty with file extension *%s" % (data_path, ext) |
|
6697 | 5025 | self.console.append(outputstr) |
|
6698 | 5026 | return |
|
6699 | 5027 | |
|
6700 | 5028 | self.proComStartDate.clear() |
|
6701 | 5029 | self.proComEndDate.clear() |
|
6702 | 5030 | |
|
6703 | 5031 | dateStrList = [] |
|
6704 | 5032 | for thisDate in dateList: |
|
6705 | 5033 | dateStr = thisDate.strftime("%Y/%m/%d") |
|
6706 | 5034 | |
|
6707 | 5035 | self.proComStartDate.addItem(dateStr) |
|
6708 | 5036 | self.proComEndDate.addItem(dateStr) |
|
6709 | 5037 | dateStrList.append(dateStr) |
|
6710 | 5038 | |
|
6711 | 5039 | self.proComStartDate.setCurrentIndex(0) |
|
6712 | 5040 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
6713 | 5041 | |
|
6714 | 5042 | self.dateList = dateStrList |
|
6715 | 5043 | self.proOk.setEnabled(True) |
|
6716 | 5044 | |
|
6717 | 5045 | return self.dateList |
|
6718 | 5046 | |
|
6719 | 5047 | def setWorkSpaceGUI(self, pathWorkSpace=None): |
|
6720 | 5048 | |
|
6721 | 5049 | if pathWorkSpace == None: |
|
6722 | 5050 | home = os.path.expanduser("~") |
|
6723 | 5051 | pathWorkSpace = os.path.join(home,'schain_workspace') |
|
6724 | 5052 | |
|
6725 | 5053 | self.pathWorkSpace = pathWorkSpace |
|
6726 | 5054 | |
|
6727 | 5055 | """ |
|
6728 | 5056 | Comandos Usados en Console |
|
6729 | 5057 | """ |
|
6730 | 5058 | def __del__(self): |
|
6731 | 5059 | sys.stdout = sys.__stdout__ |
|
6732 | 5060 | sys.stderr = sys.__stderr__ |
|
6733 | 5061 | |
|
6734 | 5062 | def normalOutputWritten(self, text): |
|
6735 | 5063 | color_black = QtGui.QColor(0,0,0) |
|
6736 | 5064 | self.console.setTextColor(color_black) |
|
6737 | 5065 | self.console.append(text) |
|
6738 | 5066 | |
|
6739 | 5067 | def errorOutputWritten(self, text): |
|
6740 | 5068 | color_red = QtGui.QColor(255,0,0) |
|
6741 | 5069 | color_black = QtGui.QColor(0,0,0) |
|
6742 | 5070 | |
|
6743 | 5071 | self.console.setTextColor(color_red) |
|
6744 | 5072 | self.console.append(text) |
|
6745 | 5073 | self.console.setTextColor(color_black) |
|
6746 | 5074 | |
|
6747 | 5075 | def setParameter(self): |
|
6748 | 5076 | |
|
6749 | 5077 | self.setWindowTitle("ROJ-Signal Chain") |
|
6750 | 5078 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) |
|
6751 | 5079 | |
|
6752 | 5080 | self.tabWidgetProject.setEnabled(False) |
|
6753 | 5081 | self.tabVoltage.setEnabled(False) |
|
6754 | 5082 | self.tabSpectra.setEnabled(False) |
|
6755 | 5083 | self.tabCorrelation.setEnabled(False) |
|
6756 | 5084 | self.frame_2.setEnabled(False) |
|
6757 | 5085 | |
|
6758 | 5086 | self.actionCreate.setShortcut('Ctrl+N') |
|
6759 | 5087 | self.actionOpen.setShortcut('Ctrl+O') |
|
6760 | 5088 | self.actionSave.setShortcut('Ctrl+S') |
|
6761 | 5089 | self.actionClose.setShortcut('Ctrl+X') |
|
6762 | 5090 | |
|
6763 | 5091 | self.actionStart.setShortcut('Ctrl+1') |
|
6764 | 5092 | self.actionPause.setShortcut('Ctrl+2') |
|
6765 | 5093 | self.actionStop.setShortcut('Ctrl+3') |
|
6766 | 5094 | |
|
6767 | 5095 | self.actionFTP.setShortcut('Ctrl+F') |
|
6768 | 5096 | |
|
6769 | 5097 | self.actionStart.setEnabled(False) |
|
6770 | 5098 | self.actionPause.setEnabled(False) |
|
6771 | 5099 | self.actionStop.setEnabled(False) |
|
6772 | 5100 | |
|
6773 | 5101 | self.actionStarToolbar.setEnabled(False) |
|
6774 | 5102 | self.actionPauseToolbar.setEnabled(False) |
|
6775 | 5103 | self.actionStopToolbar.setEnabled(False) |
|
6776 | 5104 | |
|
6777 | 5105 | self.proName.clear() |
|
6778 | 5106 | self.proDataPath.setText('') |
|
6779 | 5107 | self.console.setReadOnly(True) |
|
6780 | 5108 | self.console.append("Welcome to Signal Chain\nOpen a project or Create a new one") |
|
6781 | 5109 | self.proStartTime.setDisplayFormat("hh:mm:ss") |
|
6782 | 5110 | self.proDataType.setEnabled(False) |
|
6783 | 5111 | self.time = QtCore.QTime() |
|
6784 | 5112 | self.hour = 0 |
|
6785 | 5113 | self.min = 0 |
|
6786 | 5114 | self.sec = 0 |
|
6787 | 5115 | self.proEndTime.setDisplayFormat("hh:mm:ss") |
|
6788 | 5116 | startTime = "00:00:00" |
|
6789 | 5117 | endTime = "23:59:59" |
|
6790 | 5118 | starlist = startTime.split(":") |
|
6791 | 5119 | endlist = endTime.split(":") |
|
6792 | 5120 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
6793 | 5121 | self.proStartTime.setTime(self.time) |
|
6794 | 5122 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
6795 | 5123 | self.proEndTime.setTime(self.time) |
|
6796 | 5124 | self.proOk.setEnabled(False) |
|
6797 | 5125 | # set model Project Explorer |
|
6798 | 5126 | self.projectExplorerModel = QtGui.QStandardItemModel() |
|
6799 | 5127 | self.projectExplorerModel.setHorizontalHeaderLabels(("Project Explorer",)) |
|
6800 | 5128 | layout = QtGui.QVBoxLayout() |
|
6801 | 5129 | layout.addWidget(self.projectExplorerTree) |
|
6802 | 5130 | self.projectExplorerTree.setModel(self.projectExplorerModel) |
|
6803 | 5131 | self.projectExplorerTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) |
|
6804 | 5132 | self.projectExplorerTree.customContextMenuRequested.connect(self.on_right_click) |
|
6805 | 5133 | self.projectExplorerTree.clicked.connect(self.on_click) |
|
6806 | 5134 | self.projectExplorerTree.expandAll() |
|
6807 | 5135 | # set model Project Properties |
|
6808 | 5136 | |
|
6809 | 5137 | self.propertiesModel = TreeModel() |
|
6810 | 5138 | self.propertiesModel.initProjectView() |
|
6811 | 5139 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
6812 | 5140 | self.treeProjectProperties.expandAll() |
|
6813 | 5141 | self.treeProjectProperties.allColumnsShowFocus() |
|
6814 | 5142 | self.treeProjectProperties.resizeColumnToContents(1) |
|
6815 | 5143 | |
|
6816 | 5144 | # set Project |
|
6817 | 5145 | self.proDelay.setEnabled(False) |
|
6818 | 5146 | self.proSet.setEnabled(False) |
|
6819 | 5147 | self.proDataType.setReadOnly(True) |
|
6820 | 5148 | |
|
6821 | 5149 | # set Operation Voltage |
|
6822 | 5150 | self.volOpComChannels.setEnabled(False) |
|
6823 | 5151 | self.volOpComHeights.setEnabled(False) |
|
6824 | 5152 | self.volOpFilter.setEnabled(False) |
|
6825 | 5153 | self.volOpComProfile.setEnabled(False) |
|
6826 | 5154 | self.volOpComCode.setEnabled(False) |
|
6827 | 5155 | self.volOpFlip.setEnabled(False) |
|
6828 | 5156 | self.volOpCohInt.setEnabled(False) |
|
6829 | 5157 | self.volOpRadarfrequency.setEnabled(False) |
|
6830 | 5158 | |
|
6831 | 5159 | self.volOpChannel.setEnabled(False) |
|
6832 | 5160 | self.volOpHeights.setEnabled(False) |
|
6833 | 5161 | self.volOpProfile.setEnabled(False) |
|
6834 | 5162 | self.volOpComMode.setEnabled(False) |
|
6835 | 5163 | |
|
6836 | 5164 | self.volGraphPath.setEnabled(False) |
|
6837 | 5165 | self.volGraphPrefix.setEnabled(False) |
|
6838 | 5166 | self.volGraphToolPath.setEnabled(False) |
|
6839 | 5167 | |
|
6840 | 5168 | # set Graph Voltage |
|
6841 | 5169 | self.volGraphChannelList.setEnabled(False) |
|
6842 | 5170 | self.volGraphfreqrange.setEnabled(False) |
|
6843 | 5171 | self.volGraphHeightrange.setEnabled(False) |
|
6844 | 5172 | |
|
6845 | 5173 | # set Operation Spectra |
|
6846 | 5174 | self.specOpnFFTpoints.setEnabled(False) |
|
6847 | 5175 | self.specOpProfiles.setEnabled(False) |
|
6848 | 5176 | self.specOpippFactor.setEnabled(False) |
|
6849 | 5177 | self.specOppairsList.setEnabled(False) |
|
6850 | 5178 | self.specOpComChannel.setEnabled(False) |
|
6851 | 5179 | self.specOpComHeights.setEnabled(False) |
|
6852 | 5180 | self.specOpIncoherent.setEnabled(False) |
|
6853 | 5181 | self.specOpgetNoise.setEnabled(False) |
|
6854 | 5182 | self.specOpRadarfrequency.setEnabled(False) |
|
6855 | 5183 | |
|
6856 | 5184 | |
|
6857 | 5185 | self.specOpChannel.setEnabled(False) |
|
6858 | 5186 | self.specOpHeights.setEnabled(False) |
|
6859 | 5187 | # set Graph Spectra |
|
6860 | 5188 | self.specGgraphChannelList.setEnabled(False) |
|
6861 | 5189 | self.specGgraphFreq.setEnabled(False) |
|
6862 | 5190 | self.specGgraphHeight.setEnabled(False) |
|
6863 | 5191 | self.specGgraphDbsrange.setEnabled(False) |
|
6864 | 5192 | self.specGgraphmagnitud.setEnabled(False) |
|
6865 | 5193 | self.specGgraphTminTmax.setEnabled(False) |
|
6866 | 5194 | self.specGgraphTimeRange.setEnabled(False) |
|
6867 | 5195 | self.specGraphPath.setEnabled(False) |
|
6868 | 5196 | self.specGraphToolPath.setEnabled(False) |
|
6869 | 5197 | self.specGraphPrefix.setEnabled(False) |
|
6870 | 5198 | |
|
6871 | 5199 | self.specGgraphftpratio.setEnabled(False) |
|
6872 | 5200 | # set Operation SpectraHeis |
|
6873 | 5201 | self.specHeisOpIncoherent.setEnabled(False) |
|
6874 | 5202 | self.specHeisOpCobIncInt.setEnabled(False) |
|
6875 | 5203 | # set Graph SpectraHeis |
|
6876 | 5204 | self.specHeisGgraphChannelList.setEnabled(False) |
|
6877 | 5205 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
6878 | 5206 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
6879 | 5207 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
6880 | 5208 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
6881 | 5209 | self.specHeisGgraphftpratio.setEnabled(False) |
|
6882 | 5210 | self.specHeisGraphPath.setEnabled(False) |
|
6883 | 5211 | self.specHeisGraphPrefix.setEnabled(False) |
|
6884 | 5212 | self.specHeisGraphToolPath.setEnabled(False) |
|
6885 | 5213 | |
|
6886 | 5214 | |
|
6887 | 5215 | # tool tip gui |
|
6888 | 5216 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) |
|
6889 | 5217 | self.projectExplorerTree.setToolTip('Right clik to add Project or Unit Process') |
|
6890 | 5218 | # tool tip gui project |
|
6891 | 5219 | 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>') |
|
6892 | 5220 | self.proComWalk.setCurrentIndex(0) |
|
6893 | 5221 | # tool tip gui volOp |
|
6894 | 5222 | self.volOpChannel.setToolTip('Example: 1,2,3,4,5') |
|
6895 | 5223 | self.volOpHeights.setToolTip('Example: 90,180') |
|
6896 | 5224 | self.volOpFilter.setToolTip('Example: 2') |
|
6897 | 5225 | self.volOpProfile.setToolTip('Example:0,127') |
|
6898 | 5226 | self.volOpCohInt.setToolTip('Example: 128') |
|
6899 | 5227 | self.volOpFlip.setToolTip('ChannelList where flip will be applied. Example: 0,2,3') |
|
6900 | 5228 | self.volOpOk.setToolTip('If you have finished, please Ok ') |
|
6901 | 5229 | # tool tip gui volGraph |
|
6902 | 5230 | self.volGraphfreqrange.setToolTip('Height range. Example: 50,100') |
|
6903 | 5231 | self.volGraphHeightrange.setToolTip('Amplitude. Example: 0,10000') |
|
6904 | 5232 | # tool tip gui specOp |
|
6905 | 5233 | self.specOpnFFTpoints.setToolTip('Example: 128') |
|
6906 | 5234 | self.specOpProfiles.setToolTip('Example: 128') |
|
6907 | 5235 | self.specOpippFactor.setToolTip('Example:1.0') |
|
6908 | 5236 | self.specOpIncoherent.setToolTip('Example: 10') |
|
6909 | 5237 | self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') |
|
6910 | 5238 | |
|
6911 | 5239 | self.specOpChannel.setToolTip('Example: 0,1,2,3') |
|
6912 | 5240 | self.specOpHeights.setToolTip('Example: 90,180') |
|
6913 | 5241 | self.specOppairsList.setToolTip('Example: (0,1),(2,3)') |
|
6914 | 5242 | # tool tip gui specGraph |
|
6915 | 5243 | |
|
6916 | 5244 | self.specGgraphChannelList.setToolTip('Example: 0,3,4') |
|
6917 | 5245 | self.specGgraphFreq.setToolTip('Example: -20,20') |
|
6918 | 5246 | self.specGgraphHeight.setToolTip('Example: 100,400') |
|
6919 | 5247 | self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
6920 | 5248 | |
|
6921 | 5249 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
6922 | 5250 | |
|
6923 | 5251 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
6924 |
|
|
|
5252 | sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) | |
|
6925 | 5253 | |
|
6926 | 5254 | |
|
6927 | 5255 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
|
6928 | 5256 | """ |
|
6929 | 5257 | Class documentation goes here. |
|
6930 | 5258 | """ |
|
6931 | 5259 | closed = pyqtSignal() |
|
6932 | 5260 | create = False |
|
6933 | 5261 | |
|
6934 | 5262 | def __init__(self, parent=None): |
|
6935 | 5263 | """ |
|
6936 | 5264 | Constructor |
|
6937 | 5265 | """ |
|
6938 | 5266 | QMainWindow.__init__(self, parent) |
|
6939 | 5267 | self.setupUi(self) |
|
6940 | 5268 | self.getFromWindow = None |
|
6941 | 5269 | self.getfromWindowList = [] |
|
6942 | 5270 | self.dataTypeProject = None |
|
6943 | 5271 | |
|
6944 | 5272 | self.listUP = None |
|
6945 | 5273 | |
|
6946 | 5274 | @pyqtSignature("") |
|
6947 | 5275 | def on_unitPokbut_clicked(self): |
|
6948 | 5276 | """ |
|
6949 | 5277 | Slot documentation goes here. |
|
6950 | 5278 | """ |
|
6951 | 5279 | self.create = True |
|
6952 | 5280 | self.getFromWindow = self.getfromWindowList[int(self.comboInputBox.currentIndex())] |
|
6953 | 5281 | # self.nameofUP= str(self.nameUptxt.text()) |
|
6954 | 5282 | self.typeofUP = str(self.comboTypeBox.currentText()) |
|
6955 | 5283 | self.close() |
|
6956 | 5284 | |
|
6957 | 5285 | |
|
6958 | 5286 | @pyqtSignature("") |
|
6959 | 5287 | def on_unitPcancelbut_clicked(self): |
|
6960 | 5288 | """ |
|
6961 | 5289 | Slot documentation goes here. |
|
6962 | 5290 | """ |
|
6963 | 5291 | self.create = False |
|
6964 | 5292 | self.close() |
|
6965 | 5293 | |
|
6966 | 5294 | def loadTotalList(self): |
|
6967 | 5295 | self.comboInputBox.clear() |
|
6968 | 5296 | for i in self.getfromWindowList: |
|
6969 | 5297 | |
|
6970 | 5298 | name = i.getElementName() |
|
6971 | 5299 | if name == 'Project': |
|
6972 | 5300 | id = i.id |
|
6973 | 5301 | name = i.name |
|
6974 | 5302 | if self.dataTypeProject == 'Voltage': |
|
6975 | 5303 | self.comboTypeBox.clear() |
|
6976 | 5304 | self.comboTypeBox.addItem("Voltage") |
|
6977 | 5305 | |
|
6978 | 5306 | if self.dataTypeProject == 'Spectra': |
|
6979 | 5307 | self.comboTypeBox.clear() |
|
6980 | 5308 | self.comboTypeBox.addItem("Spectra") |
|
6981 | 5309 | self.comboTypeBox.addItem("Correlation") |
|
6982 | 5310 | if self.dataTypeProject == 'Fits': |
|
6983 | 5311 | self.comboTypeBox.clear() |
|
6984 | 5312 | self.comboTypeBox.addItem("SpectraHeis") |
|
6985 | 5313 | |
|
6986 | 5314 | |
|
6987 | 5315 | if name == 'ProcUnit': |
|
6988 | 5316 | id = int(i.id) - 1 |
|
6989 | 5317 | name = i.datatype |
|
6990 | 5318 | if name == 'Voltage': |
|
6991 | 5319 | self.comboTypeBox.clear() |
|
6992 | 5320 | self.comboTypeBox.addItem("Spectra") |
|
6993 | 5321 | self.comboTypeBox.addItem("SpectraHeis") |
|
6994 | 5322 | self.comboTypeBox.addItem("Correlation") |
|
6995 | 5323 | if name == 'Spectra': |
|
6996 | 5324 | self.comboTypeBox.clear() |
|
6997 | 5325 | self.comboTypeBox.addItem("Spectra") |
|
6998 | 5326 | self.comboTypeBox.addItem("SpectraHeis") |
|
6999 | 5327 | self.comboTypeBox.addItem("Correlation") |
|
7000 | 5328 | if name == 'SpectraHeis': |
|
7001 | 5329 | self.comboTypeBox.clear() |
|
7002 | 5330 | self.comboTypeBox.addItem("SpectraHeis") |
|
7003 | 5331 | |
|
7004 | 5332 | self.comboInputBox.addItem(str(name)) |
|
7005 | 5333 | # self.comboInputBox.addItem(str(name)+str(id)) |
|
7006 | 5334 | |
|
7007 | 5335 | def closeEvent(self, event): |
|
7008 | 5336 | self.closed.emit() |
|
7009 | 5337 | event.accept() |
|
7010 | 5338 | |
|
7011 | 5339 | class Ftp(QMainWindow, Ui_Ftp): |
|
7012 | 5340 | """ |
|
7013 | 5341 | Class documentation goes here. |
|
7014 | 5342 | """ |
|
7015 | 5343 | create = False |
|
7016 | 5344 | closed = pyqtSignal() |
|
7017 | 5345 | server = None |
|
7018 | 5346 | folder = None |
|
7019 | 5347 | username = None |
|
7020 | 5348 | password = None |
|
7021 | 5349 | ftp_wei = None |
|
7022 | 5350 | exp_code = None |
|
7023 | 5351 | sub_exp_code = None |
|
7024 | 5352 | plot_pos = None |
|
7025 | 5353 | |
|
7026 | 5354 | def __init__(self, parent=None): |
|
7027 | 5355 | """ |
|
7028 | 5356 | Constructor |
|
7029 | 5357 | """ |
|
7030 | 5358 | QMainWindow.__init__(self, parent) |
|
7031 | 5359 | self.setupUi(self) |
|
7032 | 5360 | self.setParameter() |
|
7033 | 5361 | |
|
7034 | 5362 | def setParameter(self): |
|
7035 | 5363 | self.setWindowTitle("ROJ-Signal Chain") |
|
7036 | 5364 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') |
|
7037 | 5365 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') |
|
7038 | 5366 | self.usernameFTP.setToolTip('Example: myusername') |
|
7039 | 5367 | self.passwordFTP.setToolTip('Example: mypass ') |
|
7040 | 5368 | self.weightFTP.setToolTip('Example: 0') |
|
7041 | 5369 | self.expcodeFTP.setToolTip('Example: 0') |
|
7042 | 5370 | self.subexpFTP.setToolTip('Example: 0') |
|
7043 | 5371 | self.plotposFTP.setToolTip('Example: 0') |
|
7044 | 5372 | |
|
7045 | 5373 | def setParmsfromTemporal(self, server, folder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos): |
|
7046 | 5374 | self.serverFTP.setText(str(server)) |
|
7047 | 5375 | self.folderFTP.setText(str(folder)) |
|
7048 | 5376 | self.usernameFTP.setText(str(username)) |
|
7049 | 5377 | self.passwordFTP.setText(str(password)) |
|
7050 | 5378 | self.weightFTP.setText(str(ftp_wei)) |
|
7051 | 5379 | self.expcodeFTP.setText(str(exp_code)) |
|
7052 | 5380 | self.subexpFTP.setText(str(sub_exp_code)) |
|
7053 | 5381 | self.plotposFTP.setText(str(plot_pos)) |
|
7054 | 5382 | |
|
7055 | 5383 | def getParmsFromFtpWindow(self): |
|
7056 | 5384 | """ |
|
7057 | 5385 | Return Inputs Project: |
|
7058 | 5386 | - server |
|
7059 | 5387 | - folder |
|
7060 | 5388 | - username |
|
7061 | 5389 | - password |
|
7062 | 5390 | - ftp_wei |
|
7063 | 5391 | - exp_code |
|
7064 | 5392 | - sub_exp_code |
|
7065 | 5393 | - plot_pos |
|
7066 | 5394 | """ |
|
7067 | 5395 | name_server_ftp = str(self.serverFTP.text()) |
|
7068 | 5396 | try: |
|
7069 | 5397 | name = str(self.serverFTP.text()) |
|
7070 | 5398 | except: |
|
7071 | 5399 | self.console.clear() |
|
7072 | 5400 | self.console.append("Please Write a FTP Server") |
|
7073 | 5401 | return 0 |
|
7074 | 5402 | |
|
7075 | 5403 | folder_server_ftp = str(self.folderFTP.text()) |
|
7076 | 5404 | try: |
|
7077 | 5405 | folder = str(self.folderFTP.text()) |
|
7078 | 5406 | except: |
|
7079 | 5407 | self.console.clear() |
|
7080 | 5408 | self.console.append("Please Write a Folder") |
|
7081 | 5409 | return 0 |
|
7082 | 5410 | |
|
7083 | 5411 | username_ftp = str(self.usernameFTP.text()) |
|
7084 | 5412 | try: |
|
7085 | 5413 | username = str(self.usernameFTP.text()) |
|
7086 | 5414 | except: |
|
7087 | 5415 | self.console.clear() |
|
7088 | 5416 | self.console.append("Please Write a User Name") |
|
7089 | 5417 | return 0 |
|
7090 | 5418 | |
|
7091 | 5419 | password_ftp = str(self.passwordFTP.text()) |
|
7092 | 5420 | try: |
|
7093 | 5421 | password = str(self.passwordFTP.text()) |
|
7094 | 5422 | except: |
|
7095 | 5423 | self.console.clear() |
|
7096 | 5424 | self.console.append("Please Write a passwordFTP") |
|
7097 | 5425 | return 0 |
|
7098 | 5426 | |
|
7099 | 5427 | ftp_wei = self.weightFTP.text() |
|
7100 | 5428 | if not ftp_wei == "": |
|
7101 | 5429 | try: |
|
7102 | 5430 | ftp_wei = int(self.weightFTP.text()) |
|
7103 | 5431 | except: |
|
7104 | 5432 | self.console.clear() |
|
7105 | 5433 | self.console.append("Please Write a ftp_wei number") |
|
7106 | 5434 | return 0 |
|
7107 | 5435 | |
|
7108 | 5436 | exp_code = self.expcodeFTP.text() |
|
7109 | 5437 | if not exp_code == "": |
|
7110 | 5438 | try: |
|
7111 | 5439 | exp_code = int(self.expcodeFTP.text()) |
|
7112 | 5440 | except: |
|
7113 | 5441 | self.console.clear() |
|
7114 | 5442 | self.console.append("Please Write a exp_code number") |
|
7115 | 5443 | return 0 |
|
7116 | 5444 | |
|
7117 | 5445 | |
|
7118 | 5446 | sub_exp_code = self.subexpFTP.text() |
|
7119 | 5447 | if not sub_exp_code == "": |
|
7120 | 5448 | try: |
|
7121 | 5449 | sub_exp_code = int(self.subexpFTP.text()) |
|
7122 | 5450 | except: |
|
7123 | 5451 | self.console.clear() |
|
7124 | 5452 | self.console.append("Please Write a sub_exp_code number") |
|
7125 | 5453 | return 0 |
|
7126 | 5454 | |
|
7127 | 5455 | plot_pos = self.plotposFTP.text() |
|
7128 | 5456 | if not plot_pos == "": |
|
7129 | 5457 | try: |
|
7130 | 5458 | plot_pos = int(self.plotposFTP.text()) |
|
7131 | 5459 | except: |
|
7132 | 5460 | self.console.clear() |
|
7133 | 5461 | self.console.append("Please Write a plot_pos number") |
|
7134 | 5462 | return 0 |
|
7135 | 5463 | |
|
7136 | 5464 | return name_server_ftp, folder_server_ftp, username_ftp, password_ftp, ftp_wei, exp_code, sub_exp_code, plot_pos |
|
7137 | 5465 | |
|
7138 | 5466 | @pyqtSignature("") |
|
7139 | 5467 | def on_ftpOkButton_clicked(self): |
|
7140 | 5468 | server, folder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.getParmsFromFtpWindow() |
|
7141 | 5469 | self.create = True |
|
7142 | 5470 | self.close() |
|
7143 | 5471 | |
|
7144 | 5472 | @pyqtSignature("") |
|
7145 | 5473 | def on_ftpCancelButton_clicked(self): |
|
7146 | 5474 | self.create = False |
|
7147 | 5475 | self.close() |
|
7148 | 5476 | |
|
7149 | 5477 | def closeEvent(self, event): |
|
7150 | 5478 | self.closed.emit() |
|
7151 | 5479 | event.accept() |
|
7152 | 5480 | |
|
7153 | 5481 | class ftpBuffer(): |
|
7154 | 5482 | server = None |
|
7155 | 5483 | folder = None |
|
7156 | 5484 | username = None |
|
7157 | 5485 | password = None |
|
7158 | 5486 | ftp_wei = None |
|
7159 | 5487 | exp_code = None |
|
7160 | 5488 | sub_exp_code = None |
|
7161 | 5489 | plot_pos = None |
|
7162 | 5490 | create = False |
|
7163 | 5491 | withoutconfig = False |
|
7164 | 5492 | createforView = False |
|
7165 | 5493 | localfolder = None |
|
7166 | 5494 | extension = None |
|
7167 | 5495 | period = None |
|
7168 | 5496 | protocol = None |
|
7169 | 5497 | |
|
7170 | 5498 | def __init__(self): |
|
7171 | 5499 | |
|
7172 | 5500 | self.create = False |
|
7173 | 5501 | self.server = None |
|
7174 | 5502 | self.folder = None |
|
7175 | 5503 | self.username = None |
|
7176 | 5504 | self.password = None |
|
7177 | 5505 | self.ftp_wei = None |
|
7178 | 5506 | self.exp_code = None |
|
7179 | 5507 | self.sub_exp_code = None |
|
7180 | 5508 | self.plot_pos = None |
|
7181 | 5509 | # self.create = False |
|
7182 | 5510 | self.localfolder = None |
|
7183 | 5511 | self.extension = None |
|
7184 | 5512 | self.period = None |
|
7185 | 5513 | self.protocol = None |
|
7186 | 5514 | |
|
7187 | 5515 | def setwithoutconfiguration(self): |
|
7188 | 5516 | |
|
7189 | 5517 | self.create = False |
|
7190 | 5518 | self.server = "jro-app.igp.gob.pe" |
|
7191 | 5519 | self.folder = "/home/wmaster/graficos" |
|
7192 | 5520 | self.username = "wmaster" |
|
7193 | 5521 | self.password = "mst2010vhf" |
|
7194 | 5522 | self.ftp_wei = "0" |
|
7195 | 5523 | self.exp_code = "0" |
|
7196 | 5524 | self.sub_exp_code = "0" |
|
7197 | 5525 | self.plot_pos = "0" |
|
7198 | 5526 | self.withoutconfig = True |
|
7199 | 5527 | self.localfolder = './' |
|
7200 | 5528 | self.extension = '.png' |
|
7201 | 5529 | self.period = '60' |
|
7202 | 5530 | self.protocol = 'ftp' |
|
7203 | 5531 | self.createforView = True |
|
7204 | 5532 | |
|
7205 | 5533 | def save(self, server, folder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos, localfolder='./', extension='.png', period='60', protocol='ftp'): |
|
7206 | 5534 | |
|
7207 | 5535 | self.server = server |
|
7208 | 5536 | self.folder = folder |
|
7209 | 5537 | self.username = username |
|
7210 | 5538 | self.password = password |
|
7211 | 5539 | self.ftp_wei = ftp_wei |
|
7212 | 5540 | self.exp_code = exp_code |
|
7213 | 5541 | self.sub_exp_code = sub_exp_code |
|
7214 | 5542 | self.plot_pos = plot_pos |
|
7215 | 5543 | self.create = True |
|
7216 | 5544 | self.withoutconfig = False |
|
7217 | 5545 | self.createforView = True |
|
7218 | 5546 | self.localfolder = localfolder |
|
7219 | 5547 | |
|
7220 | 5548 | |
|
7221 | 5549 | def recover(self): |
|
7222 | 5550 | |
|
7223 | 5551 | return self.server, self.folder, self.username, self.password, self.ftp_wei, self.exp_code, self.sub_exp_code, self.plot_pos |
|
7224 | 5552 | |
|
7225 | 5553 | class ShowMeConsole(QtCore.QObject): |
|
7226 | 5554 | textWritten = QtCore.pyqtSignal(str) |
|
7227 | 5555 | def write (self, text): |
|
7228 | 5556 | self.textWritten.emit(str(text)) |
|
7229 | 5557 | |
|
7230 | 5558 | class PlotManager(): |
|
7231 | 5559 | def __init__(self, queue): |
|
7232 | 5560 | self.queue = queue |
|
7233 | 5561 | self.objPlotDict = {} |
|
7234 | 5562 | |
|
7235 | 5563 | def processIncoming(self): |
|
7236 | 5564 | while self.queue.qsize(): |
|
7237 | 5565 | try: |
|
7238 | 5566 | dataFromQueue = self.queue.get(True) |
|
7239 | 5567 | if dataFromQueue == None: |
|
7240 | 5568 | continue |
|
7241 | 5569 | |
|
7242 | 5570 | dataPlot = dataFromQueue['data'] |
|
7243 | 5571 | kwargs = dataFromQueue['kwargs'] |
|
7244 | 5572 | id = kwargs['id'] |
|
7245 | 5573 | if 'channelList' in kwargs.keys(): |
|
7246 | 5574 | channelList = kwargs['channelList'] |
|
7247 | 5575 | else: |
|
7248 | 5576 | channelList = None |
|
7249 | 5577 | plotname = kwargs.pop('type') |
|
7250 | 5578 | |
|
7251 | 5579 | if not(id in self.objPlotDict.keys()): |
|
7252 | 5580 | className = eval(plotname) |
|
7253 | 5581 | self.objPlotDict[id] = className(id, channelList, dataPlot) |
|
7254 | 5582 | self.objPlotDict[id].show() |
|
7255 | 5583 | |
|
7256 | 5584 | self.objPlotDict[id].run(dataPlot , **kwargs) |
|
7257 | 5585 | |
|
7258 | 5586 | except Queue.Empty: |
|
7259 | 5587 | pass |
|
7260 | 5588 | |
|
7261 | 5589 |
@@ -1,415 +1,451 | |||
|
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_SpectraTab(object): |
|
18 | 18 | |
|
19 | 19 | def setupUi(self): |
|
20 | 20 | |
|
21 | 21 | self.tabSpectra = QtGui.QWidget() |
|
22 | 22 | self.tabSpectra.setObjectName(_fromUtf8("tabSpectra")) |
|
23 | 23 | self.gridLayout_7 = QtGui.QGridLayout(self.tabSpectra) |
|
24 | 24 | self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7")) |
|
25 | 25 | self.frame_5 = QtGui.QFrame(self.tabSpectra) |
|
26 | 26 | self.frame_5.setFrameShape(QtGui.QFrame.StyledPanel) |
|
27 | 27 | self.frame_5.setFrameShadow(QtGui.QFrame.Raised) |
|
28 | 28 | self.frame_5.setObjectName(_fromUtf8("frame_5")) |
|
29 | 29 | self.gridLayout_18 = QtGui.QGridLayout(self.frame_5) |
|
30 | 30 | self.gridLayout_18.setObjectName(_fromUtf8("gridLayout_18")) |
|
31 | 31 | self.specOpOk = QtGui.QPushButton(self.frame_5) |
|
32 | 32 | self.specOpOk.setObjectName(_fromUtf8("specOpOk")) |
|
33 | 33 | self.gridLayout_18.addWidget(self.specOpOk, 0, 0, 1, 1) |
|
34 | 34 | self.specGraphClear = QtGui.QPushButton(self.frame_5) |
|
35 | 35 | self.specGraphClear.setObjectName(_fromUtf8("specGraphClear")) |
|
36 | 36 | self.gridLayout_18.addWidget(self.specGraphClear, 0, 1, 1, 1) |
|
37 | 37 | self.gridLayout_7.addWidget(self.frame_5, 1, 1, 1, 1) |
|
38 | 38 | self.tabWidgetSpectra = QtGui.QTabWidget(self.tabSpectra) |
|
39 | 39 | self.tabWidgetSpectra.setObjectName(_fromUtf8("tabWidgetSpectra")) |
|
40 | 40 | self.tabopSpectra = QtGui.QWidget() |
|
41 | 41 | self.tabopSpectra.setObjectName(_fromUtf8("tabopSpectra")) |
|
42 | 42 | self.gridLayout_5 = QtGui.QGridLayout(self.tabopSpectra) |
|
43 | 43 | self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5")) |
|
44 | 44 | self.specOpCebCrossSpectra = QtGui.QCheckBox(self.tabopSpectra) |
|
45 | 45 | self.specOpCebCrossSpectra.setObjectName(_fromUtf8("specOpCebCrossSpectra")) |
|
46 | 46 | self.gridLayout_5.addWidget(self.specOpCebCrossSpectra, 4, 0, 1, 2) |
|
47 | 47 | self.specOpComChannel = QtGui.QComboBox(self.tabopSpectra) |
|
48 | 48 | self.specOpComChannel.setObjectName(_fromUtf8("specOpComChannel")) |
|
49 | 49 | self.specOpComChannel.addItem(_fromUtf8("")) |
|
50 | 50 | self.specOpComChannel.addItem(_fromUtf8("")) |
|
51 | 51 | self.gridLayout_5.addWidget(self.specOpComChannel, 8, 0, 1, 2) |
|
52 | 52 | self.specOpChannel = QtGui.QLineEdit(self.tabopSpectra) |
|
53 | 53 | self.specOpChannel.setObjectName(_fromUtf8("specOpChannel")) |
|
54 | 54 | self.gridLayout_5.addWidget(self.specOpChannel, 8, 3, 1, 2) |
|
55 | 55 | self.specOpComHeights = QtGui.QComboBox(self.tabopSpectra) |
|
56 | 56 | self.specOpComHeights.setObjectName(_fromUtf8("specOpComHeights")) |
|
57 | 57 | self.specOpComHeights.addItem(_fromUtf8("")) |
|
58 | 58 | self.specOpComHeights.addItem(_fromUtf8("")) |
|
59 | 59 | self.gridLayout_5.addWidget(self.specOpComHeights, 11, 0, 1, 2) |
|
60 | 60 | self.specOpHeights = QtGui.QLineEdit(self.tabopSpectra) |
|
61 | 61 | self.specOpHeights.setObjectName(_fromUtf8("specOpHeights")) |
|
62 | 62 | self.gridLayout_5.addWidget(self.specOpHeights, 11, 3, 1, 2) |
|
63 | 63 | self.specOpIncoherent = QtGui.QLineEdit(self.tabopSpectra) |
|
64 | 64 | self.specOpIncoherent.setObjectName(_fromUtf8("specOpIncoherent")) |
|
65 | 65 | self.gridLayout_5.addWidget(self.specOpIncoherent, 13, 3, 1, 2) |
|
66 | 66 | self.specOpCebRemoveDC = QtGui.QCheckBox(self.tabopSpectra) |
|
67 | 67 | self.specOpCebRemoveDC.setObjectName(_fromUtf8("specOpCebRemoveDC")) |
|
68 | 68 | self.gridLayout_5.addWidget(self.specOpCebRemoveDC, 14, 0, 1, 2) |
|
69 | 69 | self.specOpCebHeights = QtGui.QCheckBox(self.tabopSpectra) |
|
70 | 70 | self.specOpCebHeights.setObjectName(_fromUtf8("specOpCebHeights")) |
|
71 | 71 | self.gridLayout_5.addWidget(self.specOpCebHeights, 9, 0, 1, 1) |
|
72 | 72 | self.specOpCebChannel = QtGui.QCheckBox(self.tabopSpectra) |
|
73 | 73 | self.specOpCebChannel.setObjectName(_fromUtf8("specOpCebChannel")) |
|
74 | 74 | self.gridLayout_5.addWidget(self.specOpCebChannel, 7, 0, 1, 1) |
|
75 | 75 | self.specOppairsList = QtGui.QLineEdit(self.tabopSpectra) |
|
76 | 76 | self.specOppairsList.setObjectName(_fromUtf8("specOppairsList")) |
|
77 | 77 | self.gridLayout_5.addWidget(self.specOppairsList, 6, 3, 1, 2) |
|
78 | 78 | self.specOpnFFTpoints = QtGui.QLineEdit(self.tabopSpectra) |
|
79 | 79 | self.specOpnFFTpoints.setObjectName(_fromUtf8("specOpnFFTpoints")) |
|
80 | 80 | self.gridLayout_5.addWidget(self.specOpnFFTpoints, 2, 3, 1, 2) |
|
81 | 81 | self.label_31 = QtGui.QLabel(self.tabopSpectra) |
|
82 | 82 | self.label_31.setObjectName(_fromUtf8("label_31")) |
|
83 | 83 | self.gridLayout_5.addWidget(self.label_31, 6, 0, 1, 2) |
|
84 | 84 | self.label_26 = QtGui.QLabel(self.tabopSpectra) |
|
85 | 85 | self.label_26.setObjectName(_fromUtf8("label_26")) |
|
86 | 86 | self.gridLayout_5.addWidget(self.label_26, 2, 0, 1, 2) |
|
87 | 87 | self.specOpCebIncoherent = QtGui.QCheckBox(self.tabopSpectra) |
|
88 | 88 | self.specOpCebIncoherent.setObjectName(_fromUtf8("specOpCebIncoherent")) |
|
89 | 89 | self.gridLayout_5.addWidget(self.specOpCebIncoherent, 12, 0, 1, 1) |
|
90 | 90 | self.specOpCobIncInt = QtGui.QComboBox(self.tabopSpectra) |
|
91 | 91 | self.specOpCobIncInt.setObjectName(_fromUtf8("specOpCobIncInt")) |
|
92 | 92 | self.specOpCobIncInt.addItem(_fromUtf8("")) |
|
93 | 93 | self.specOpCobIncInt.addItem(_fromUtf8("")) |
|
94 | 94 | self.gridLayout_5.addWidget(self.specOpCobIncInt, 13, 0, 1, 2) |
|
95 | 95 | spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
96 | 96 | self.gridLayout_5.addItem(spacerItem9, 12, 3, 1, 1) |
|
97 | 97 | self.specOpCebRadarfrequency = QtGui.QCheckBox(self.tabopSpectra) |
|
98 | 98 | self.specOpCebRadarfrequency.setObjectName(_fromUtf8("specOpCebRadarfrequency")) |
|
99 | 99 | self.gridLayout_5.addWidget(self.specOpCebRadarfrequency, 0, 0, 1, 2) |
|
100 | 100 | spacerItem10 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
101 | 101 | self.gridLayout_5.addItem(spacerItem10, 9, 3, 1, 1) |
|
102 | 102 | spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
103 | 103 | self.gridLayout_5.addItem(spacerItem11, 7, 3, 1, 1) |
|
104 | 104 | self.specOpRadarfrequency = QtGui.QLineEdit(self.tabopSpectra) |
|
105 | 105 | self.specOpRadarfrequency.setObjectName(_fromUtf8("specOpRadarfrequency")) |
|
106 | 106 | self.gridLayout_5.addWidget(self.specOpRadarfrequency, 0, 3, 1, 2) |
|
107 | 107 | spacerItem12 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
108 | 108 | self.gridLayout_5.addItem(spacerItem12, 4, 3, 1, 1) |
|
109 | 109 | self.label_21 = QtGui.QLabel(self.tabopSpectra) |
|
110 | 110 | self.label_21.setObjectName(_fromUtf8("label_21")) |
|
111 | 111 | self.gridLayout_5.addWidget(self.label_21, 1, 0, 1, 1) |
|
112 | 112 | self.specOpProfiles = QtGui.QLineEdit(self.tabopSpectra) |
|
113 | 113 | self.specOpProfiles.setObjectName(_fromUtf8("specOpProfiles")) |
|
114 | 114 | self.gridLayout_5.addWidget(self.specOpProfiles, 1, 3, 1, 2) |
|
115 | 115 | self.specOpCebRemoveInt = QtGui.QCheckBox(self.tabopSpectra) |
|
116 | 116 | self.specOpCebRemoveInt.setObjectName(_fromUtf8("specOpCebRemoveInt")) |
|
117 | 117 | self.gridLayout_5.addWidget(self.specOpCebRemoveInt, 15, 0, 1, 1) |
|
118 | 118 | spacerItem13 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
119 | 119 | self.gridLayout_5.addItem(spacerItem13, 15, 3, 1, 1) |
|
120 | 120 | self.label_70 = QtGui.QLabel(self.tabopSpectra) |
|
121 | 121 | self.label_70.setObjectName(_fromUtf8("label_70")) |
|
122 | 122 | self.gridLayout_5.addWidget(self.label_70, 3, 0, 1, 1) |
|
123 | 123 | self.specOpCebgetNoise = QtGui.QCheckBox(self.tabopSpectra) |
|
124 | 124 | self.specOpCebgetNoise.setObjectName(_fromUtf8("specOpCebgetNoise")) |
|
125 | 125 | self.gridLayout_5.addWidget(self.specOpCebgetNoise, 16, 0, 1, 1) |
|
126 | 126 | self.specOpippFactor = QtGui.QLineEdit(self.tabopSpectra) |
|
127 | 127 | self.specOpippFactor.setObjectName(_fromUtf8("specOpippFactor")) |
|
128 | 128 | self.gridLayout_5.addWidget(self.specOpippFactor, 3, 3, 1, 2) |
|
129 | 129 | self.specOpComRemoveDC = QtGui.QComboBox(self.tabopSpectra) |
|
130 | 130 | self.specOpComRemoveDC.setObjectName(_fromUtf8("specOpComRemoveDC")) |
|
131 | 131 | self.specOpComRemoveDC.addItem(_fromUtf8("")) |
|
132 | 132 | self.specOpComRemoveDC.addItem(_fromUtf8("")) |
|
133 | 133 | self.gridLayout_5.addWidget(self.specOpComRemoveDC, 14, 3, 1, 2) |
|
134 | 134 | self.specOpgetNoise = QtGui.QLineEdit(self.tabopSpectra) |
|
135 | 135 | self.specOpgetNoise.setObjectName(_fromUtf8("specOpgetNoise")) |
|
136 | 136 | self.gridLayout_5.addWidget(self.specOpgetNoise, 16, 3, 1, 2) |
|
137 | 137 | self.tabWidgetSpectra.addTab(self.tabopSpectra, _fromUtf8("")) |
|
138 | ||
|
139 | ||
|
138 | 140 | self.tabgraphSpectra = QtGui.QWidget() |
|
139 | 141 | self.tabgraphSpectra.setObjectName(_fromUtf8("tabgraphSpectra")) |
|
140 | 142 | self.gridLayout_9 = QtGui.QGridLayout(self.tabgraphSpectra) |
|
141 | 143 | self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9")) |
|
142 | self.label_44 = QtGui.QLabel(self.tabgraphSpectra) | |
|
143 | self.label_44.setObjectName(_fromUtf8("label_44")) | |
|
144 | self.gridLayout_9.addWidget(self.label_44, 10, 0, 1, 1) | |
|
144 | ||
|
145 | 145 | spacerItem14 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
146 | self.gridLayout_9.addItem(spacerItem14, 14, 2, 1, 1) | |
|
147 | self.label_20 = QtGui.QLabel(self.tabgraphSpectra) | |
|
148 | self.label_20.setObjectName(_fromUtf8("label_20")) | |
|
149 | self.gridLayout_9.addWidget(self.label_20, 21, 0, 1, 1) | |
|
150 | self.specGraphSaveRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
151 | self.specGraphSaveRTInoise.setText(_fromUtf8("")) | |
|
152 | self.specGraphSaveRTInoise.setObjectName(_fromUtf8("specGraphSaveRTInoise")) | |
|
153 | self.gridLayout_9.addWidget(self.specGraphSaveRTInoise, 13, 4, 1, 1) | |
|
154 | self.specGgraphmagnitud = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
155 | self.specGgraphmagnitud.setObjectName(_fromUtf8("specGgraphmagnitud")) | |
|
156 | self.gridLayout_9.addWidget(self.specGgraphmagnitud, 20, 1, 1, 7) | |
|
157 | self.specGraphSaveSpectra = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
158 | self.specGraphSaveSpectra.setText(_fromUtf8("")) | |
|
159 | self.specGraphSaveSpectra.setObjectName(_fromUtf8("specGraphSaveSpectra")) | |
|
160 | self.gridLayout_9.addWidget(self.specGraphSaveSpectra, 6, 4, 1, 1) | |
|
161 | self.specGgraphChannelList = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
162 | self.specGgraphChannelList.setObjectName(_fromUtf8("specGgraphChannelList")) | |
|
163 | self.gridLayout_9.addWidget(self.specGgraphChannelList, 15, 1, 1, 7) | |
|
164 | self.label_25 = QtGui.QLabel(self.tabgraphSpectra) | |
|
165 | self.label_25.setObjectName(_fromUtf8("label_25")) | |
|
166 | self.gridLayout_9.addWidget(self.label_25, 2, 0, 1, 1) | |
|
167 | self.specGgraphTminTmax = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
168 | self.specGgraphTminTmax.setObjectName(_fromUtf8("specGgraphTminTmax")) | |
|
169 | self.gridLayout_9.addWidget(self.specGgraphTminTmax, 21, 1, 1, 7) | |
|
170 | spacerItem15 = QtGui.QSpacerItem(28, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
171 | self.gridLayout_9.addItem(spacerItem15, 27, 6, 1, 2) | |
|
172 | spacerItem16 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) | |
|
173 | self.gridLayout_9.addItem(spacerItem16, 3, 5, 1, 1) | |
|
174 | self.label_42 = QtGui.QLabel(self.tabgraphSpectra) | |
|
175 | self.label_42.setObjectName(_fromUtf8("label_42")) | |
|
176 | self.gridLayout_9.addWidget(self.label_42, 9, 0, 1, 1) | |
|
177 | self.label_16 = QtGui.QLabel(self.tabgraphSpectra) | |
|
178 | self.label_16.setObjectName(_fromUtf8("label_16")) | |
|
179 | self.gridLayout_9.addWidget(self.label_16, 18, 0, 1, 1) | |
|
180 | self.label_17 = QtGui.QLabel(self.tabgraphSpectra) | |
|
181 | self.label_17.setObjectName(_fromUtf8("label_17")) | |
|
182 | self.gridLayout_9.addWidget(self.label_17, 19, 0, 1, 1) | |
|
183 | self.label_18 = QtGui.QLabel(self.tabgraphSpectra) | |
|
184 | self.label_18.setObjectName(_fromUtf8("label_18")) | |
|
185 | self.gridLayout_9.addWidget(self.label_18, 20, 0, 1, 1) | |
|
186 | self.specGgraphFreq = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
187 | self.specGgraphFreq.setObjectName(_fromUtf8("specGgraphFreq")) | |
|
188 | self.gridLayout_9.addWidget(self.specGgraphFreq, 16, 1, 1, 7) | |
|
189 | self.specGgraphHeight = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
190 | self.specGgraphHeight.setObjectName(_fromUtf8("specGgraphHeight")) | |
|
191 | self.gridLayout_9.addWidget(self.specGgraphHeight, 18, 1, 1, 7) | |
|
192 | spacerItem17 = QtGui.QSpacerItem(49, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
193 | self.gridLayout_9.addItem(spacerItem17, 27, 0, 1, 1) | |
|
146 | self.gridLayout_9.addItem(spacerItem14, 14, 2, 1, 1) | |
|
147 | ||
|
194 | 148 | self.label_24 = QtGui.QLabel(self.tabgraphSpectra) |
|
195 | 149 | self.label_24.setObjectName(_fromUtf8("label_24")) |
|
196 | 150 | self.gridLayout_9.addWidget(self.label_24, 0, 0, 1, 1) |
|
197 | self.specGraphPrefix = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
198 | self.specGraphPrefix.setObjectName(_fromUtf8("specGraphPrefix")) | |
|
199 | self.gridLayout_9.addWidget(self.specGraphPrefix, 2, 1, 1, 7) | |
|
200 | self.specGgraphDbsrange = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
201 | self.specGgraphDbsrange.setObjectName(_fromUtf8("specGgraphDbsrange")) | |
|
202 | self.gridLayout_9.addWidget(self.specGgraphDbsrange, 19, 1, 1, 7) | |
|
203 | self.label_46 = QtGui.QLabel(self.tabgraphSpectra) | |
|
204 | self.label_46.setObjectName(_fromUtf8("label_46")) | |
|
205 | self.gridLayout_9.addWidget(self.label_46, 11, 0, 1, 1) | |
|
206 | self.label_22 = QtGui.QLabel(self.tabgraphSpectra) | |
|
207 | self.label_22.setObjectName(_fromUtf8("label_22")) | |
|
208 | self.gridLayout_9.addWidget(self.label_22, 16, 0, 1, 1) | |
|
151 | ||
|
209 | 152 | self.specGraphPath = QtGui.QLineEdit(self.tabgraphSpectra) |
|
210 | 153 | self.specGraphPath.setObjectName(_fromUtf8("specGraphPath")) |
|
211 | 154 | self.gridLayout_9.addWidget(self.specGraphPath, 0, 1, 1, 6) |
|
212 | self.label_41 = QtGui.QLabel(self.tabgraphSpectra) | |
|
213 | self.label_41.setObjectName(_fromUtf8("label_41")) | |
|
214 | self.gridLayout_9.addWidget(self.label_41, 8, 0, 1, 1) | |
|
155 | ||
|
215 | 156 | self.specGraphToolPath = QtGui.QToolButton(self.tabgraphSpectra) |
|
216 | 157 | self.specGraphToolPath.setObjectName(_fromUtf8("specGraphToolPath")) |
|
217 | 158 | self.gridLayout_9.addWidget(self.specGraphToolPath, 0, 7, 1, 1) |
|
218 | self.label_6 = QtGui.QLabel(self.tabgraphSpectra) | |
|
219 | self.label_6.setObjectName(_fromUtf8("label_6")) | |
|
220 | self.gridLayout_9.addWidget(self.label_6, 15, 0, 1, 1) | |
|
159 | ||
|
160 | self.label_25 = QtGui.QLabel(self.tabgraphSpectra) | |
|
161 | self.label_25.setObjectName(_fromUtf8("label_25")) | |
|
162 | self.gridLayout_9.addWidget(self.label_25, 2, 0, 1, 1) | |
|
163 | self.specGraphPrefix = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
164 | self.specGraphPrefix.setObjectName(_fromUtf8("specGraphPrefix")) | |
|
165 | self.gridLayout_9.addWidget(self.specGraphPrefix, 2, 1, 1, 7) | |
|
166 | ||
|
167 | ||
|
221 | 168 | self.label_40 = QtGui.QLabel(self.tabgraphSpectra) |
|
222 | 169 | self.label_40.setObjectName(_fromUtf8("label_40")) |
|
223 | 170 | self.gridLayout_9.addWidget(self.label_40, 6, 0, 1, 1) |
|
171 | self.label_41 = QtGui.QLabel(self.tabgraphSpectra) | |
|
172 | self.label_41.setObjectName(_fromUtf8("label_41")) | |
|
173 | self.gridLayout_9.addWidget(self.label_41, 8, 0, 1, 1) | |
|
174 | self.label_42 = QtGui.QLabel(self.tabgraphSpectra) | |
|
175 | self.label_42.setObjectName(_fromUtf8("label_42")) | |
|
176 | self.gridLayout_9.addWidget(self.label_42, 9, 0, 1, 1) | |
|
177 | self.label_44 = QtGui.QLabel(self.tabgraphSpectra) | |
|
178 | self.label_44.setObjectName(_fromUtf8("label_44")) | |
|
179 | self.gridLayout_9.addWidget(self.label_44, 10, 0, 1, 1) | |
|
180 | self.label_46 = QtGui.QLabel(self.tabgraphSpectra) | |
|
181 | self.label_46.setObjectName(_fromUtf8("label_46")) | |
|
182 | self.gridLayout_9.addWidget(self.label_46, 11, 0, 1, 1) | |
|
183 | self.label_45 = QtGui.QLabel(self.tabgraphSpectra) | |
|
184 | self.label_45.setObjectName(_fromUtf8("label_45")) | |
|
185 | self.gridLayout_9.addWidget(self.label_45, 13, 0, 1, 1) | |
|
186 | ||
|
187 | self.label_43 = QtGui.QLabel(self.tabgraphSpectra) | |
|
188 | self.label_43.setObjectName(_fromUtf8("label_43")) | |
|
189 | self.gridLayout_9.addWidget(self.label_43, 3, 3, 2, 1) | |
|
224 | 190 | self.specGraphCebSpectraplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
225 | 191 | self.specGraphCebSpectraplot.setText(_fromUtf8("")) |
|
226 | 192 | self.specGraphCebSpectraplot.setObjectName(_fromUtf8("specGraphCebSpectraplot")) |
|
227 |
self.gridLayout_9.addWidget(self.specGraphCebSpectraplot, 6, |
|
|
193 | self.gridLayout_9.addWidget(self.specGraphCebSpectraplot, 6, 3, 1, 1) | |
|
228 | 194 | self.specGraphCebCrossSpectraplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
229 | 195 | self.specGraphCebCrossSpectraplot.setText(_fromUtf8("")) |
|
230 | 196 | self.specGraphCebCrossSpectraplot.setObjectName(_fromUtf8("specGraphCebCrossSpectraplot")) |
|
231 |
self.gridLayout_9.addWidget(self.specGraphCebCrossSpectraplot, 8, |
|
|
197 | self.gridLayout_9.addWidget(self.specGraphCebCrossSpectraplot, 8, 3, 1, 1) | |
|
232 | 198 | self.specGraphCebRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
233 | 199 | self.specGraphCebRTIplot.setText(_fromUtf8("")) |
|
234 | 200 | self.specGraphCebRTIplot.setObjectName(_fromUtf8("specGraphCebRTIplot")) |
|
235 |
self.gridLayout_9.addWidget(self.specGraphCebRTIplot, 9, |
|
|
201 | self.gridLayout_9.addWidget(self.specGraphCebRTIplot, 9, 3, 1, 1) | |
|
236 | 202 | self.specGraphCebCoherencmap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
237 | 203 | self.specGraphCebCoherencmap.setText(_fromUtf8("")) |
|
238 | 204 | self.specGraphCebCoherencmap.setObjectName(_fromUtf8("specGraphCebCoherencmap")) |
|
239 |
self.gridLayout_9.addWidget(self.specGraphCebCoherencmap, 10, |
|
|
205 | self.gridLayout_9.addWidget(self.specGraphCebCoherencmap, 10, 3, 1, 1) | |
|
240 | 206 | self.specGraphPowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) |
|
241 | 207 | self.specGraphPowerprofile.setText(_fromUtf8("")) |
|
242 | 208 | self.specGraphPowerprofile.setObjectName(_fromUtf8("specGraphPowerprofile")) |
|
243 |
self.gridLayout_9.addWidget(self.specGraphPowerprofile, 11, |
|
|
209 | self.gridLayout_9.addWidget(self.specGraphPowerprofile, 11, 3, 1, 1) | |
|
210 | self.specGraphCebRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
211 | self.specGraphCebRTInoise.setText(_fromUtf8("")) | |
|
212 | self.specGraphCebRTInoise.setObjectName(_fromUtf8("specGraphCebRTInoise")) | |
|
213 | self.gridLayout_9.addWidget(self.specGraphCebRTInoise, 13, 3, 1, 1) | |
|
214 | ||
|
215 | # spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
216 | # self.gridLayout_9.addItem(spacerItem18, 4, 3, 1, 1) | |
|
217 | ||
|
218 | self.label_47 = QtGui.QLabel(self.tabgraphSpectra) | |
|
219 | self.label_47.setObjectName(_fromUtf8("label_47")) | |
|
220 | self.gridLayout_9.addWidget(self.label_47, 3, 5, 2, 1) | |
|
221 | self.specGraphSaveSpectra = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
222 | self.specGraphSaveSpectra.setText(_fromUtf8("")) | |
|
223 | self.specGraphSaveSpectra.setObjectName(_fromUtf8("specGraphSaveSpectra")) | |
|
224 | self.gridLayout_9.addWidget(self.specGraphSaveSpectra, 6, 5, 1, 1) | |
|
244 | 225 | self.specGraphSaveCross = QtGui.QCheckBox(self.tabgraphSpectra) |
|
245 | 226 | self.specGraphSaveCross.setText(_fromUtf8("")) |
|
246 | 227 | self.specGraphSaveCross.setObjectName(_fromUtf8("specGraphSaveCross")) |
|
247 |
self.gridLayout_9.addWidget(self.specGraphSaveCross, 8, |
|
|
248 |
self.specGraph |
|
|
249 |
self.specGraph |
|
|
250 |
self.specGraph |
|
|
251 |
self.gridLayout_9.addWidget(self.specGraph |
|
|
252 | spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
253 | self.gridLayout_9.addItem(spacerItem18, 4, 3, 1, 1) | |
|
254 | self.specGraphSavePowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
255 | self.specGraphSavePowerprofile.setText(_fromUtf8("")) | |
|
256 | self.specGraphSavePowerprofile.setObjectName(_fromUtf8("specGraphSavePowerprofile")) | |
|
257 | self.gridLayout_9.addWidget(self.specGraphSavePowerprofile, 11, 4, 1, 1) | |
|
228 | self.gridLayout_9.addWidget(self.specGraphSaveCross, 8, 5, 1, 1) | |
|
229 | self.specGraphSaveRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
230 | self.specGraphSaveRTIplot.setText(_fromUtf8("")) | |
|
231 | self.specGraphSaveRTIplot.setObjectName(_fromUtf8("specGraphSaveRTIplot")) | |
|
232 | self.gridLayout_9.addWidget(self.specGraphSaveRTIplot, 9, 5, 1, 1) | |
|
258 | 233 | self.specGraphSaveCoherencemap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
259 | 234 | self.specGraphSaveCoherencemap.setText(_fromUtf8("")) |
|
260 | 235 | self.specGraphSaveCoherencemap.setObjectName(_fromUtf8("specGraphSaveCoherencemap")) |
|
261 |
self.gridLayout_9.addWidget(self.specGraphSaveCoherencemap, 10, |
|
|
262 | spacerItem19 = QtGui.QSpacerItem(39, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
263 | self.gridLayout_9.addItem(spacerItem19, 27, 4, 1, 1) | |
|
264 | self.specGgraphftpratio = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
265 | self.specGgraphftpratio.setObjectName(_fromUtf8("specGgraphftpratio")) | |
|
266 | self.gridLayout_9.addWidget(self.specGgraphftpratio, 23, 1, 1, 7) | |
|
267 | self.label_43 = QtGui.QLabel(self.tabgraphSpectra) | |
|
268 |
self. |
|
|
269 |
self.gridLayout_9.addWidget(self. |
|
|
236 | self.gridLayout_9.addWidget(self.specGraphSaveCoherencemap, 10, 5, 1, 1) | |
|
237 | self.specGraphSavePowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
238 | self.specGraphSavePowerprofile.setText(_fromUtf8("")) | |
|
239 | self.specGraphSavePowerprofile.setObjectName(_fromUtf8("specGraphSavePowerprofile")) | |
|
240 | self.gridLayout_9.addWidget(self.specGraphSavePowerprofile, 11, 5, 1, 1) | |
|
241 | self.specGraphSaveRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
242 | self.specGraphSaveRTInoise.setText(_fromUtf8("")) | |
|
243 | self.specGraphSaveRTInoise.setObjectName(_fromUtf8("specGraphSaveRTInoise")) | |
|
244 | self.gridLayout_9.addWidget(self.specGraphSaveRTInoise, 13, 5, 1, 1) | |
|
245 | ||
|
246 | self.label_19 = QtGui.QLabel(self.tabgraphSpectra) | |
|
247 | self.label_19.setObjectName(_fromUtf8("label_19")) | |
|
248 | self.gridLayout_9.addWidget(self.label_19, 3, 7, 2, 1) | |
|
249 | self.specGraphftpSpectra = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
250 | self.specGraphftpSpectra.setText(_fromUtf8("")) | |
|
251 | self.specGraphftpSpectra.setObjectName(_fromUtf8("specGraphftpSpectra")) | |
|
252 | self.gridLayout_9.addWidget(self.specGraphftpSpectra, 6, 7, 1, 1) | |
|
270 | 253 | self.specGraphftpCross = QtGui.QCheckBox(self.tabgraphSpectra) |
|
271 | 254 | self.specGraphftpCross.setText(_fromUtf8("")) |
|
272 | 255 | self.specGraphftpCross.setObjectName(_fromUtf8("specGraphftpCross")) |
|
273 |
self.gridLayout_9.addWidget(self.specGraphftpCross, 8, |
|
|
274 | self.label_29 = QtGui.QLabel(self.tabgraphSpectra) | |
|
275 | self.label_29.setObjectName(_fromUtf8("label_29")) | |
|
276 | self.gridLayout_9.addWidget(self.label_29, 23, 0, 1, 1) | |
|
277 | self.label_47 = QtGui.QLabel(self.tabgraphSpectra) | |
|
278 | self.label_47.setObjectName(_fromUtf8("label_47")) | |
|
279 | self.gridLayout_9.addWidget(self.label_47, 3, 4, 2, 1) | |
|
256 | self.gridLayout_9.addWidget(self.specGraphftpCross, 8, 7, 1, 1) | |
|
280 | 257 | self.specGraphftpRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
281 | 258 | self.specGraphftpRTIplot.setText(_fromUtf8("")) |
|
282 | 259 | self.specGraphftpRTIplot.setObjectName(_fromUtf8("specGraphftpRTIplot")) |
|
283 |
self.gridLayout_9.addWidget(self.specGraphftpRTIplot, 9, |
|
|
260 | self.gridLayout_9.addWidget(self.specGraphftpRTIplot, 9, 7, 1, 1) | |
|
284 | 261 | self.specGraphftpCoherencemap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
285 | 262 | self.specGraphftpCoherencemap.setText(_fromUtf8("")) |
|
286 | 263 | self.specGraphftpCoherencemap.setObjectName(_fromUtf8("specGraphftpCoherencemap")) |
|
287 |
self.gridLayout_9.addWidget(self.specGraphftpCoherencemap, 10, |
|
|
264 | self.gridLayout_9.addWidget(self.specGraphftpCoherencemap, 10, 7, 1, 1) | |
|
288 | 265 | self.specGraphftpPowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) |
|
289 | 266 | self.specGraphftpPowerprofile.setText(_fromUtf8("")) |
|
290 | 267 | self.specGraphftpPowerprofile.setObjectName(_fromUtf8("specGraphftpPowerprofile")) |
|
291 |
self.gridLayout_9.addWidget(self.specGraphftpPowerprofile, 11, |
|
|
292 | self.label_19 = QtGui.QLabel(self.tabgraphSpectra) | |
|
293 | self.label_19.setObjectName(_fromUtf8("label_19")) | |
|
294 | self.gridLayout_9.addWidget(self.label_19, 3, 6, 2, 2) | |
|
295 | self.specGraphSaveRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
296 | self.specGraphSaveRTIplot.setText(_fromUtf8("")) | |
|
297 | self.specGraphSaveRTIplot.setObjectName(_fromUtf8("specGraphSaveRTIplot")) | |
|
298 | self.gridLayout_9.addWidget(self.specGraphSaveRTIplot, 9, 4, 1, 1) | |
|
299 | self.label_45 = QtGui.QLabel(self.tabgraphSpectra) | |
|
300 | self.label_45.setObjectName(_fromUtf8("label_45")) | |
|
301 | self.gridLayout_9.addWidget(self.label_45, 13, 0, 1, 1) | |
|
268 | self.gridLayout_9.addWidget(self.specGraphftpPowerprofile, 11, 7, 1, 1) | |
|
302 | 269 | self.specGraphftpRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) |
|
303 | 270 | self.specGraphftpRTInoise.setText(_fromUtf8("")) |
|
304 | 271 | self.specGraphftpRTInoise.setObjectName(_fromUtf8("specGraphftpRTInoise")) |
|
305 |
self.gridLayout_9.addWidget(self.specGraphftpRTInoise, 13, |
|
|
306 | self.specGraphCebRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) | |
|
307 | self.specGraphCebRTInoise.setText(_fromUtf8("")) | |
|
308 | self.specGraphCebRTInoise.setObjectName(_fromUtf8("specGraphCebRTInoise")) | |
|
309 | self.gridLayout_9.addWidget(self.specGraphCebRTInoise, 13, 2, 1, 1) | |
|
272 | self.gridLayout_9.addWidget(self.specGraphftpRTInoise, 13, 7, 1, 1) | |
|
273 | ||
|
274 | spacerItem19 = QtGui.QSpacerItem(39, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
275 | self.gridLayout_9.addItem(spacerItem19, 27, 4, 1, 1) | |
|
276 | ||
|
277 | self.label_22 = QtGui.QLabel(self.tabgraphSpectra) | |
|
278 | self.label_22.setObjectName(_fromUtf8("label_22")) | |
|
279 | self.gridLayout_9.addWidget(self.label_22, 16, 0, 1, 1) | |
|
280 | self.specGgraphFreq = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
281 | self.specGgraphFreq.setObjectName(_fromUtf8("specGgraphFreq")) | |
|
282 | self.gridLayout_9.addWidget(self.specGgraphFreq, 16, 2, 1, 2) | |
|
283 | ||
|
284 | self.label_16 = QtGui.QLabel(self.tabgraphSpectra) | |
|
285 | self.label_16.setObjectName(_fromUtf8("label_16")) | |
|
286 | self.gridLayout_9.addWidget(self.label_16, 17, 0, 1, 1) | |
|
287 | self.specGgraphHeight = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
288 | self.specGgraphHeight.setObjectName(_fromUtf8("specGgraphHeight")) | |
|
289 | self.gridLayout_9.addWidget(self.specGgraphHeight, 17, 2, 1, 2) | |
|
290 | ||
|
291 | self.label_17 = QtGui.QLabel(self.tabgraphSpectra) | |
|
292 | self.label_17.setObjectName(_fromUtf8("label_17")) | |
|
293 | self.gridLayout_9.addWidget(self.label_17, 18, 0, 1, 1) | |
|
294 | self.specGgraphDbsrange = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
295 | self.specGgraphDbsrange.setObjectName(_fromUtf8("specGgraphDbsrange")) | |
|
296 | self.gridLayout_9.addWidget(self.specGgraphDbsrange, 18, 2, 1, 2) | |
|
297 | ||
|
298 | self.specGraphTminTmaxLabel = QtGui.QLabel(self.tabgraphSpectra) | |
|
299 | self.specGraphTminTmaxLabel.setObjectName(_fromUtf8("specGraphTminTmaxLabel")) | |
|
300 | self.gridLayout_9.addWidget(self.specGraphTminTmaxLabel, 19, 0, 1, 2) | |
|
301 | self.specGgraphTminTmax = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
302 | self.specGgraphTminTmax.setObjectName(_fromUtf8("specGgraphTminTmax")) | |
|
303 | self.gridLayout_9.addWidget(self.specGgraphTminTmax, 19, 2, 1, 2) | |
|
304 | ||
|
305 | self.specGraphMagLabel = QtGui.QLabel(self.tabgraphSpectra) | |
|
306 | self.specGraphMagLabel.setObjectName(_fromUtf8("specGraphMagLabel")) | |
|
307 | self.gridLayout_9.addWidget(self.specGraphMagLabel, 16, 4, 1, 2) | |
|
308 | self.specGgraphmagnitud = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
309 | self.specGgraphmagnitud.setObjectName(_fromUtf8("specGgraphmagnitud")) | |
|
310 | self.gridLayout_9.addWidget(self.specGgraphmagnitud, 16, 6, 1, 2) | |
|
311 | ||
|
312 | self.specGraphPhaseLabel = QtGui.QLabel(self.tabgraphSpectra) | |
|
313 | self.specGraphPhaseLabel.setObjectName(_fromUtf8("specGraphPhaseLabel")) | |
|
314 | self.gridLayout_9.addWidget(self.specGraphPhaseLabel, 17, 4, 1, 2) | |
|
315 | self.specGgraphPhase = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
316 | self.specGgraphPhase.setObjectName(_fromUtf8("specGgraphPhase")) | |
|
317 | self.gridLayout_9.addWidget(self.specGgraphPhase, 17, 6, 1, 2) | |
|
318 | ||
|
319 | self.label_6 = QtGui.QLabel(self.tabgraphSpectra) | |
|
320 | self.label_6.setObjectName(_fromUtf8("label_6")) | |
|
321 | self.gridLayout_9.addWidget(self.label_6, 18, 4, 1, 1) | |
|
322 | self.specGgraphChannelList = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
323 | self.specGgraphChannelList.setObjectName(_fromUtf8("specGgraphChannelList")) | |
|
324 | self.gridLayout_9.addWidget(self.specGgraphChannelList, 18, 6, 1, 2) | |
|
325 | ||
|
326 | self.label_29 = QtGui.QLabel(self.tabgraphSpectra) | |
|
327 | self.label_29.setObjectName(_fromUtf8("label_29")) | |
|
328 | self.gridLayout_9.addWidget(self.label_29, 19, 4, 1, 2) | |
|
329 | self.specGgraphftpratio = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
330 | self.specGgraphftpratio.setObjectName(_fromUtf8("specGgraphftpratio")) | |
|
331 | self.gridLayout_9.addWidget(self.specGgraphftpratio, 19, 6, 1, 2) | |
|
332 | ||
|
310 | 333 | self.label_48 = QtGui.QLabel(self.tabgraphSpectra) |
|
311 | 334 | self.label_48.setObjectName(_fromUtf8("label_48")) |
|
312 |
self.gridLayout_9.addWidget(self.label_48, 2 |
|
|
335 | self.gridLayout_9.addWidget(self.label_48, 20, 4, 1, 2) | |
|
313 | 336 | self.specGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectra) |
|
314 | 337 | self.specGgraphTimeRange.setObjectName(_fromUtf8("specGgraphTimeRange")) |
|
315 |
self.gridLayout_9.addWidget(self.specGgraphTimeRange, 2 |
|
|
338 | self.gridLayout_9.addWidget(self.specGgraphTimeRange, 20, 6, 1, 2) | |
|
339 | ||
|
340 | spacerItem15 = QtGui.QSpacerItem(28, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
341 | self.gridLayout_9.addItem(spacerItem15, 27, 6, 1, 2) | |
|
342 | spacerItem16 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) | |
|
343 | self.gridLayout_9.addItem(spacerItem16, 3, 5, 1, 1) | |
|
344 | spacerItem17 = QtGui.QSpacerItem(49, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
345 | self.gridLayout_9.addItem(spacerItem17, 27, 0, 1, 1) | |
|
346 | ||
|
347 | ||
|
348 | ||
|
316 | 349 | self.tabWidgetSpectra.addTab(self.tabgraphSpectra, _fromUtf8("")) |
|
317 | 350 | self.taboutputSpectra = QtGui.QWidget() |
|
318 | 351 | self.taboutputSpectra.setObjectName(_fromUtf8("taboutputSpectra")) |
|
319 | 352 | self.gridLayout_11 = QtGui.QGridLayout(self.taboutputSpectra) |
|
320 | 353 | self.gridLayout_11.setObjectName(_fromUtf8("gridLayout_11")) |
|
321 | 354 | self.label_39 = QtGui.QLabel(self.taboutputSpectra) |
|
322 | 355 | self.label_39.setObjectName(_fromUtf8("label_39")) |
|
323 | 356 | self.gridLayout_11.addWidget(self.label_39, 0, 0, 1, 1) |
|
324 | 357 | self.specOutputComData = QtGui.QComboBox(self.taboutputSpectra) |
|
325 | 358 | self.specOutputComData.setObjectName(_fromUtf8("specOutputComData")) |
|
326 | 359 | self.specOutputComData.addItem(_fromUtf8("")) |
|
327 | 360 | self.gridLayout_11.addWidget(self.specOutputComData, 0, 2, 1, 2) |
|
328 | 361 | self.label_34 = QtGui.QLabel(self.taboutputSpectra) |
|
329 | 362 | self.label_34.setObjectName(_fromUtf8("label_34")) |
|
330 | 363 | self.gridLayout_11.addWidget(self.label_34, 1, 0, 1, 1) |
|
331 | 364 | self.specOutputPath = QtGui.QLineEdit(self.taboutputSpectra) |
|
332 | 365 | self.specOutputPath.setObjectName(_fromUtf8("specOutputPath")) |
|
333 | 366 | self.gridLayout_11.addWidget(self.specOutputPath, 1, 2, 1, 1) |
|
334 | 367 | spacerItem20 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
335 | 368 | self.gridLayout_11.addItem(spacerItem20, 4, 2, 1, 1) |
|
336 | 369 | self.specOutputToolPath = QtGui.QToolButton(self.taboutputSpectra) |
|
337 | 370 | self.specOutputToolPath.setObjectName(_fromUtf8("specOutputToolPath")) |
|
338 | 371 | self.gridLayout_11.addWidget(self.specOutputToolPath, 1, 3, 1, 1) |
|
339 | 372 | self.specOutputblocksperfile = QtGui.QLineEdit(self.taboutputSpectra) |
|
340 | 373 | self.specOutputblocksperfile.setObjectName(_fromUtf8("specOutputblocksperfile")) |
|
341 | 374 | self.gridLayout_11.addWidget(self.specOutputblocksperfile, 2, 2, 1, 1) |
|
342 | 375 | self.label_9 = QtGui.QLabel(self.taboutputSpectra) |
|
343 | 376 | self.label_9.setObjectName(_fromUtf8("label_9")) |
|
344 | 377 | self.gridLayout_11.addWidget(self.label_9, 2, 0, 1, 2) |
|
345 | 378 | self.label_38 = QtGui.QLabel(self.taboutputSpectra) |
|
346 | 379 | self.label_38.setObjectName(_fromUtf8("label_38")) |
|
347 | 380 | self.gridLayout_11.addWidget(self.label_38, 3, 0, 1, 1) |
|
348 | 381 | self.specOutputprofileperblock = QtGui.QLineEdit(self.taboutputSpectra) |
|
349 | 382 | self.specOutputprofileperblock.setObjectName(_fromUtf8("specOutputprofileperblock")) |
|
350 | 383 | self.gridLayout_11.addWidget(self.specOutputprofileperblock, 3, 2, 1, 1) |
|
351 | 384 | self.tabWidgetSpectra.addTab(self.taboutputSpectra, _fromUtf8("")) |
|
352 | 385 | self.gridLayout_7.addWidget(self.tabWidgetSpectra, 0, 1, 1, 1) |
|
353 | 386 | |
|
354 | 387 | self.tabWidgetProject.addTab(self.tabSpectra, _fromUtf8("")) |
|
355 | 388 | |
|
356 | 389 | self.tabWidgetSpectra.setCurrentIndex(0) |
|
357 | 390 | |
|
358 | 391 | def retranslateUi(self): |
|
359 | 392 | |
|
360 | 393 | self.specOpOk.setText(_translate("MainWindow", "Ok", None)) |
|
361 | 394 | self.specGraphClear.setText(_translate("MainWindow", "Clear", None)) |
|
362 | 395 | self.specOpCebCrossSpectra.setText(_translate("MainWindow", "Select Cross Spectra", None)) |
|
363 | 396 | self.specOpComChannel.setItemText(0, _translate("MainWindow", "Value", None)) |
|
364 | 397 | self.specOpComChannel.setItemText(1, _translate("MainWindow", "Index", None)) |
|
365 | 398 | self.specOpComHeights.setItemText(0, _translate("MainWindow", "Value", None)) |
|
366 | 399 | self.specOpComHeights.setItemText(1, _translate("MainWindow", "Index", None)) |
|
367 | 400 | self.specOpCebRemoveDC.setText(_translate("MainWindow", "Remove DC", None)) |
|
368 | 401 | self.specOpCebHeights.setText(_translate("MainWindow", "Select Heights", None)) |
|
369 | 402 | self.specOpCebChannel.setText(_translate("MainWindow", "Select Channel", None)) |
|
370 | 403 | self.label_31.setText(_translate("MainWindow", "x-y pairs", None)) |
|
371 | 404 | self.label_26.setText(_translate("MainWindow", "nFFTPoints", None)) |
|
372 | 405 | self.specOpCebIncoherent.setText(_translate("MainWindow", "Incoherent Integration", None)) |
|
373 | 406 | self.specOpCobIncInt.setItemText(0, _translate("MainWindow", "Time Interval", None)) |
|
374 | 407 | self.specOpCobIncInt.setItemText(1, _translate("MainWindow", "Profiles", None)) |
|
375 | 408 | self.specOpCebRadarfrequency.setText(_translate("MainWindow", "Radar Frequency", None)) |
|
376 | 409 | self.label_21.setText(_translate("MainWindow", "Profiles", None)) |
|
377 | 410 | self.specOpCebRemoveInt.setText(_translate("MainWindow", "Remove Interference", None)) |
|
378 | 411 | self.label_70.setText(_translate("MainWindow", "IppFactor", None)) |
|
379 | 412 | self.specOpCebgetNoise.setText(_translate("MainWindow", "Get Noise", None)) |
|
380 | 413 | self.specOpComRemoveDC.setItemText(0, _translate("MainWindow", "Mode 1", None)) |
|
381 | 414 | self.specOpComRemoveDC.setItemText(1, _translate("MainWindow", "Mode 2", None)) |
|
382 | 415 | self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.tabopSpectra), _translate("MainWindow", "Operation", None)) |
|
383 | 416 | |
|
384 | 417 | self.label_44.setText(_translate("MainWindow", "Coherence Map", None)) |
|
385 |
self. |
|
|
418 | self.specGraphTminTmaxLabel.setText(_translate("MainWindow", "Time range:", None)) | |
|
386 | 419 | self.label_25.setText(_translate("MainWindow", "Prefix", None)) |
|
387 | 420 | self.label_42.setText(_translate("MainWindow", "RTI Plot", None)) |
|
388 | 421 | self.label_16.setText(_translate("MainWindow", "Height range", None)) |
|
389 | 422 | self.label_17.setText(_translate("MainWindow", "dB range", None)) |
|
390 |
self. |
|
|
423 | self.specGraphMagLabel.setText(_translate("MainWindow", "Coh. Magnitud ", None)) | |
|
391 | 424 | self.label_24.setText(_translate("MainWindow", "Path", None)) |
|
392 | 425 | self.label_46.setText(_translate("MainWindow", "Power Profile", None)) |
|
393 | self.label_22.setText(_translate("MainWindow", "Freq/Vel:", None)) | |
|
426 | self.label_22.setText(_translate("MainWindow", "Freq/Vel range:", None)) | |
|
394 | 427 | self.label_41.setText(_translate("MainWindow", "Cross Spectra Plot", None)) |
|
395 | 428 | self.specGraphToolPath.setText(_translate("MainWindow", "...", None)) |
|
396 | 429 | self.label_6.setText(_translate("MainWindow", "Channel List:", None)) |
|
397 | 430 | self.label_40.setText(_translate("MainWindow", "Spectra Plot", None)) |
|
398 | 431 | self.label_43.setText(_translate("MainWindow", "Show", None)) |
|
399 | self.label_29.setText(_translate("MainWindow", "Wr Period:", None)) | |
|
432 | self.label_29.setText(_translate("MainWindow", "Writing Period:", None)) | |
|
400 | 433 | self.label_47.setText(_translate("MainWindow", "Save", None)) |
|
401 |
self.label_19.setText(_translate("MainWindow", " |
|
|
434 | self.label_19.setText(_translate("MainWindow", "Ftp", None)) | |
|
402 | 435 | self.label_45.setText(_translate("MainWindow", "Noise", None)) |
|
403 | 436 | self.label_48.setText(_translate("MainWindow", "Time Range:", None)) |
|
437 | self.specGraphPhaseLabel.setText(_translate("MainWindow", "Coh. Phase:", None)) | |
|
438 | self.label_48.hide() | |
|
439 | self.specGgraphTimeRange.hide() | |
|
404 | 440 | self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.tabgraphSpectra), _translate("MainWindow", "Graphics", None)) |
|
405 | 441 | |
|
406 | 442 | self.label_39.setText(_translate("MainWindow", "Type:", None)) |
|
407 | 443 | self.specOutputComData.setItemText(0, _translate("MainWindow", ".pdata", None)) |
|
408 | 444 | self.label_34.setText(_translate("MainWindow", "Path:", None)) |
|
409 | 445 | self.specOutputToolPath.setText(_translate("MainWindow", "...", None)) |
|
410 | 446 | self.label_9.setText(_translate("MainWindow", "Blocks per File: ", None)) |
|
411 | 447 | self.label_38.setText(_translate("MainWindow", "Profile per Block: ", None)) |
|
412 | 448 | self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.taboutputSpectra), _translate("MainWindow", "Output", None)) |
|
413 | 449 | |
|
414 | 450 | self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectra), _translate("MainWindow", "Spectra", None)) |
|
415 | 451 | No newline at end of file |
@@ -1,610 +1,610 | |||
|
1 | 1 | import os |
|
2 | 2 | import numpy |
|
3 | 3 | import time, datetime |
|
4 | 4 | import mpldriver |
|
5 | 5 | |
|
6 | 6 | from schainpy.model.proc.jroproc_base import Operation |
|
7 | 7 | |
|
8 | 8 | def isRealtime(utcdatatime): |
|
9 | 9 | utcnow = time.mktime(time.localtime()) |
|
10 | 10 | delta = abs(utcnow - utcdatatime) # abs |
|
11 | 11 | if delta >= 30.: |
|
12 | 12 | return False |
|
13 | 13 | return True |
|
14 | 14 | |
|
15 | 15 | class Figure(Operation): |
|
16 | 16 | |
|
17 | 17 | __driver = mpldriver |
|
18 | 18 | __isConfigThread = False |
|
19 | 19 | fig = None |
|
20 | 20 | |
|
21 | 21 | id = None |
|
22 | 22 | wintitle = None |
|
23 | 23 | width = None |
|
24 | 24 | height = None |
|
25 | 25 | nplots = None |
|
26 | 26 | timerange = None |
|
27 | 27 | |
|
28 | 28 | axesObjList = [] |
|
29 | 29 | |
|
30 | 30 | WIDTH = None |
|
31 | 31 | HEIGHT = None |
|
32 | 32 | PREFIX = 'fig' |
|
33 | 33 | |
|
34 | 34 | xmin = None |
|
35 | 35 | xmax = None |
|
36 | 36 | |
|
37 | 37 | counter_imagwr = 0 |
|
38 | 38 | |
|
39 | 39 | figfile = None |
|
40 | 40 | |
|
41 | 41 | def __init__(self): |
|
42 | 42 | |
|
43 | 43 | raise ValueError, "This method is not implemented" |
|
44 | 44 | |
|
45 | 45 | def __del__(self): |
|
46 | 46 | |
|
47 | 47 | self.__driver.closeFigure() |
|
48 | 48 | |
|
49 | 49 | def getFilename(self, name, ext='.png'): |
|
50 | 50 | |
|
51 | 51 | path = '%s%03d' %(self.PREFIX, self.id) |
|
52 | 52 | filename = '%s_%s%s' %(self.PREFIX, name, ext) |
|
53 | 53 | return os.path.join(path, filename) |
|
54 | 54 | |
|
55 | 55 | def getAxesObjList(self): |
|
56 | 56 | |
|
57 | 57 | return self.axesObjList |
|
58 | 58 | |
|
59 | 59 | def getSubplots(self): |
|
60 | 60 | |
|
61 | 61 | raise ValueError, "Abstract method: This method should be defined" |
|
62 | 62 | |
|
63 | 63 | def getScreenDim(self, widthplot, heightplot): |
|
64 | 64 | |
|
65 | 65 | nrow, ncol = self.getSubplots() |
|
66 | 66 | |
|
67 | 67 | widthscreen = widthplot*ncol |
|
68 | 68 | heightscreen = heightplot*nrow |
|
69 | 69 | |
|
70 | 70 | return widthscreen, heightscreen |
|
71 | 71 | |
|
72 | 72 | def getTimeLim(self, x, xmin=None, xmax=None, timerange=None): |
|
73 | 73 | |
|
74 | 74 | if self.xmin != None and self.xmax != None: |
|
75 | 75 | if timerange == None: |
|
76 | 76 | timerange = self.xmax - self.xmin |
|
77 | 77 | xmin = self.xmin + timerange |
|
78 | 78 | xmax = self.xmax + timerange |
|
79 | 79 | |
|
80 | 80 | return xmin, xmax |
|
81 | 81 | |
|
82 | 82 | if timerange == None and (xmin==None or xmax==None): |
|
83 | 83 | timerange = 14400 #seconds |
|
84 | 84 | #raise ValueError, "(timerange) or (xmin & xmax) should be defined" |
|
85 | 85 | |
|
86 | 86 | if timerange != None: |
|
87 | 87 | txmin = x[0] - x[0] % min(timerange/10, 10*60) |
|
88 | 88 | else: |
|
89 | 89 | txmin = x[0] - x[0] % 10*60 |
|
90 | 90 | |
|
91 | 91 | thisdatetime = datetime.datetime.utcfromtimestamp(txmin) |
|
92 | 92 | thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0)) |
|
93 | 93 | |
|
94 | 94 | if timerange != None: |
|
95 | 95 | xmin = (thisdatetime - thisdate).seconds/(60*60.) |
|
96 | 96 | xmax = xmin + timerange/(60*60.) |
|
97 | 97 | |
|
98 | 98 | mindt = thisdate + datetime.timedelta(hours=xmin) - datetime.timedelta(seconds=time.timezone) |
|
99 | 99 | xmin_sec = time.mktime(mindt.timetuple()) |
|
100 | 100 | |
|
101 | 101 | maxdt = thisdate + datetime.timedelta(hours=xmax) - datetime.timedelta(seconds=time.timezone) |
|
102 | 102 | xmax_sec = time.mktime(maxdt.timetuple()) |
|
103 | 103 | |
|
104 | 104 | return xmin_sec, xmax_sec |
|
105 | 105 | |
|
106 | 106 | def init(self, id, nplots, wintitle): |
|
107 | 107 | |
|
108 | 108 | raise ValueError, "This method has been replaced with createFigure" |
|
109 | 109 | |
|
110 | 110 | def createFigure(self, id, wintitle, widthplot=None, heightplot=None, show=True): |
|
111 | 111 | |
|
112 | 112 | """ |
|
113 | 113 | Crea la figura de acuerdo al driver y parametros seleccionados seleccionados. |
|
114 | 114 | Las dimensiones de la pantalla es calculada a partir de los atributos self.WIDTH |
|
115 | 115 | y self.HEIGHT y el numero de subplots (nrow, ncol) |
|
116 | 116 | |
|
117 | 117 | Input: |
|
118 | 118 | id : Los parametros necesarios son |
|
119 | 119 | wintitle : |
|
120 | 120 | |
|
121 | 121 | """ |
|
122 | 122 | |
|
123 | 123 | if widthplot == None: |
|
124 | 124 | widthplot = self.WIDTH |
|
125 | 125 | |
|
126 | 126 | if heightplot == None: |
|
127 | 127 | heightplot = self.HEIGHT |
|
128 | 128 | |
|
129 | 129 | self.id = id |
|
130 | 130 | |
|
131 | 131 | self.wintitle = wintitle |
|
132 | 132 | |
|
133 | 133 | self.widthscreen, self.heightscreen = self.getScreenDim(widthplot, heightplot) |
|
134 | 134 | |
|
135 | 135 | self.fig = self.__driver.createFigure(id=self.id, |
|
136 | 136 | wintitle=self.wintitle, |
|
137 | 137 | width=self.widthscreen, |
|
138 | 138 | height=self.heightscreen, |
|
139 | 139 | show=show) |
|
140 | 140 | |
|
141 | 141 | self.axesObjList = [] |
|
142 | 142 | self.counter_imagwr = 0 |
|
143 | 143 | |
|
144 | 144 | |
|
145 | 145 | def setDriver(self, driver=mpldriver): |
|
146 | 146 | |
|
147 | 147 | self.__driver = driver |
|
148 | 148 | |
|
149 | 149 | def setTitle(self, title): |
|
150 | 150 | |
|
151 | 151 | self.__driver.setTitle(self.fig, title) |
|
152 | 152 | |
|
153 | 153 | def setWinTitle(self, title): |
|
154 | 154 | |
|
155 | 155 | self.__driver.setWinTitle(self.fig, title=title) |
|
156 | 156 | |
|
157 | 157 | def setTextFromAxes(self, text): |
|
158 | 158 | |
|
159 | 159 | raise ValueError, "Este metodo ha sido reemplazaado con el metodo setText de la clase Axes" |
|
160 | 160 | |
|
161 | 161 | def makeAxes(self, nrow, ncol, xpos, ypos, colspan, rowspan): |
|
162 | 162 | |
|
163 | 163 | raise ValueError, "Este metodo ha sido reemplazaado con el metodo addAxes" |
|
164 | 164 | |
|
165 | 165 | def addAxes(self, *args): |
|
166 | 166 | """ |
|
167 | 167 | |
|
168 | 168 | Input: |
|
169 | 169 | *args : Los parametros necesarios son |
|
170 | 170 | nrow, ncol, xpos, ypos, colspan, rowspan |
|
171 | 171 | """ |
|
172 | 172 | |
|
173 | 173 | axesObj = Axes(self.fig, *args) |
|
174 | 174 | self.axesObjList.append(axesObj) |
|
175 | 175 | |
|
176 | 176 | def saveFigure(self, figpath, figfile, *args): |
|
177 | 177 | |
|
178 | 178 | filename = os.path.join(figpath, figfile) |
|
179 | 179 | |
|
180 | 180 | fullpath = os.path.split(filename)[0] |
|
181 | 181 | |
|
182 | 182 | if not os.path.exists(fullpath): |
|
183 | 183 | subpath = os.path.split(fullpath)[0] |
|
184 | 184 | |
|
185 | 185 | if not os.path.exists(subpath): |
|
186 | 186 | os.mkdir(subpath) |
|
187 | 187 | |
|
188 | 188 | os.mkdir(fullpath) |
|
189 | 189 | |
|
190 | 190 | self.__driver.saveFigure(self.fig, filename, *args) |
|
191 | 191 | |
|
192 | 192 | def save(self, figpath, figfile=None, save=True, ftp=False, wr_period=1, thisDatetime=None, update_figfile=True): |
|
193 | 193 | |
|
194 | 194 | self.counter_imagwr += 1 |
|
195 | 195 | if self.counter_imagwr < wr_period: |
|
196 | 196 | return |
|
197 | 197 | |
|
198 | 198 | self.counter_imagwr = 0 |
|
199 | 199 | |
|
200 | 200 | if save: |
|
201 | 201 | |
|
202 |
if figfile |
|
|
202 | if not figfile: | |
|
203 | 203 | |
|
204 | 204 | if not thisDatetime: |
|
205 | 205 | raise ValueError, "Saving figure: figfile or thisDatetime should be defined" |
|
206 | 206 | return |
|
207 | 207 | |
|
208 | 208 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
209 | 209 | figfile = self.getFilename(name = str_datetime) |
|
210 | 210 | |
|
211 | 211 | if self.figfile == None: |
|
212 | 212 | self.figfile = figfile |
|
213 | 213 | |
|
214 | 214 | if update_figfile: |
|
215 | 215 | self.figfile = figfile |
|
216 | 216 | |
|
217 | 217 | # store png plot to local folder |
|
218 | 218 | self.saveFigure(figpath, self.figfile) |
|
219 | 219 | |
|
220 | 220 | |
|
221 | 221 | if not ftp: |
|
222 | 222 | return |
|
223 | 223 | |
|
224 | 224 | if not thisDatetime: |
|
225 | 225 | return |
|
226 | 226 | |
|
227 | 227 | # store png plot to FTP server according to RT-Web format |
|
228 | 228 | ftp_filename = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS) |
|
229 | 229 | # ftp_filename = os.path.join(figpath, name) |
|
230 | 230 | self.saveFigure(figpath, ftp_filename) |
|
231 | 231 | |
|
232 | 232 | def getNameToFtp(self, thisDatetime, FTP_WEI, EXP_CODE, SUB_EXP_CODE, PLOT_CODE, PLOT_POS): |
|
233 | 233 | YEAR_STR = '%4.4d'%thisDatetime.timetuple().tm_year |
|
234 | 234 | DOY_STR = '%3.3d'%thisDatetime.timetuple().tm_yday |
|
235 | 235 | FTP_WEI = '%2.2d'%FTP_WEI |
|
236 | 236 | EXP_CODE = '%3.3d'%EXP_CODE |
|
237 | 237 | SUB_EXP_CODE = '%2.2d'%SUB_EXP_CODE |
|
238 | 238 | PLOT_CODE = '%2.2d'%PLOT_CODE |
|
239 | 239 | PLOT_POS = '%2.2d'%PLOT_POS |
|
240 | 240 | name = YEAR_STR + DOY_STR + FTP_WEI + EXP_CODE + SUB_EXP_CODE + PLOT_CODE + PLOT_POS |
|
241 | 241 | return name |
|
242 | 242 | |
|
243 | 243 | def draw(self): |
|
244 | 244 | |
|
245 | 245 | self.__driver.draw(self.fig) |
|
246 | 246 | |
|
247 | 247 | def run(self): |
|
248 | 248 | |
|
249 | 249 | raise ValueError, "This method is not implemented" |
|
250 | 250 | |
|
251 | 251 | def close(self, show=False): |
|
252 | 252 | |
|
253 | 253 | self.__driver.closeFigure(show=show, fig=self.fig) |
|
254 | 254 | |
|
255 | 255 | axesList = property(getAxesObjList) |
|
256 | 256 | |
|
257 | 257 | |
|
258 | 258 | class Axes: |
|
259 | 259 | |
|
260 | 260 | __driver = mpldriver |
|
261 | 261 | fig = None |
|
262 | 262 | ax = None |
|
263 | 263 | plot = None |
|
264 | 264 | __missing = 1E30 |
|
265 | 265 | __firsttime = None |
|
266 | 266 | |
|
267 | 267 | __showprofile = False |
|
268 | 268 | |
|
269 | 269 | xmin = None |
|
270 | 270 | xmax = None |
|
271 | 271 | ymin = None |
|
272 | 272 | ymax = None |
|
273 | 273 | zmin = None |
|
274 | 274 | zmax = None |
|
275 | 275 | |
|
276 | 276 | x_buffer = None |
|
277 | 277 | z_buffer = None |
|
278 | 278 | |
|
279 | 279 | decimationx = None |
|
280 | 280 | decimationy = None |
|
281 | 281 | |
|
282 | 282 | __MAXNUMX = 300 |
|
283 | 283 | __MAXNUMY = 150 |
|
284 | 284 | |
|
285 | 285 | def __init__(self, *args): |
|
286 | 286 | |
|
287 | 287 | """ |
|
288 | 288 | |
|
289 | 289 | Input: |
|
290 | 290 | *args : Los parametros necesarios son |
|
291 | 291 | fig, nrow, ncol, xpos, ypos, colspan, rowspan |
|
292 | 292 | """ |
|
293 | 293 | |
|
294 | 294 | ax = self.__driver.createAxes(*args) |
|
295 | 295 | self.fig = args[0] |
|
296 | 296 | self.ax = ax |
|
297 | 297 | self.plot = None |
|
298 | 298 | |
|
299 | 299 | self.__firsttime = True |
|
300 | 300 | self.idlineList = [] |
|
301 | 301 | |
|
302 | 302 | self.x_buffer = numpy.array([]) |
|
303 | 303 | self.z_buffer = numpy.array([]) |
|
304 | 304 | |
|
305 | 305 | def setText(self, text): |
|
306 | 306 | |
|
307 | 307 | self.__driver.setAxesText(self.ax, text) |
|
308 | 308 | |
|
309 | 309 | def setXAxisAsTime(self): |
|
310 | 310 | pass |
|
311 | 311 | |
|
312 | 312 | def pline(self, x, y, |
|
313 | 313 | xmin=None, xmax=None, |
|
314 | 314 | ymin=None, ymax=None, |
|
315 | 315 | xlabel='', ylabel='', |
|
316 | 316 | title='', |
|
317 | 317 | **kwargs): |
|
318 | 318 | |
|
319 | 319 | """ |
|
320 | 320 | |
|
321 | 321 | Input: |
|
322 | 322 | x : |
|
323 | 323 | y : |
|
324 | 324 | xmin : |
|
325 | 325 | xmax : |
|
326 | 326 | ymin : |
|
327 | 327 | ymax : |
|
328 | 328 | xlabel : |
|
329 | 329 | ylabel : |
|
330 | 330 | title : |
|
331 | 331 | **kwargs : Los parametros aceptados son |
|
332 | 332 | |
|
333 | 333 | ticksize |
|
334 | 334 | ytick_visible |
|
335 | 335 | """ |
|
336 | 336 | |
|
337 | 337 | if self.__firsttime: |
|
338 | 338 | |
|
339 | 339 | if xmin == None: xmin = numpy.nanmin(x) |
|
340 | 340 | if xmax == None: xmax = numpy.nanmax(x) |
|
341 | 341 | if ymin == None: ymin = numpy.nanmin(y) |
|
342 | 342 | if ymax == None: ymax = numpy.nanmax(y) |
|
343 | 343 | |
|
344 | 344 | self.plot = self.__driver.createPline(self.ax, x, y, |
|
345 | 345 | xmin, xmax, |
|
346 | 346 | ymin, ymax, |
|
347 | 347 | xlabel=xlabel, |
|
348 | 348 | ylabel=ylabel, |
|
349 | 349 | title=title, |
|
350 | 350 | **kwargs) |
|
351 | 351 | |
|
352 | 352 | self.idlineList.append(0) |
|
353 | 353 | self.__firsttime = False |
|
354 | 354 | return |
|
355 | 355 | |
|
356 | 356 | self.__driver.pline(self.plot, x, y, xlabel=xlabel, |
|
357 | 357 | ylabel=ylabel, |
|
358 | 358 | title=title) |
|
359 | 359 | |
|
360 | 360 | def addpline(self, x, y, idline, **kwargs): |
|
361 | 361 | lines = self.ax.lines |
|
362 | 362 | |
|
363 | 363 | if idline in self.idlineList: |
|
364 | 364 | self.__driver.set_linedata(self.ax, x, y, idline) |
|
365 | 365 | |
|
366 | 366 | if idline not in(self.idlineList): |
|
367 | 367 | self.__driver.addpline(self.ax, x, y, **kwargs) |
|
368 | 368 | self.idlineList.append(idline) |
|
369 | 369 | |
|
370 | 370 | return |
|
371 | 371 | |
|
372 | 372 | def pmultiline(self, x, y, |
|
373 | 373 | xmin=None, xmax=None, |
|
374 | 374 | ymin=None, ymax=None, |
|
375 | 375 | xlabel='', ylabel='', |
|
376 | 376 | title='', |
|
377 | 377 | **kwargs): |
|
378 | 378 | |
|
379 | 379 | if self.__firsttime: |
|
380 | 380 | |
|
381 | 381 | if xmin == None: xmin = numpy.nanmin(x) |
|
382 | 382 | if xmax == None: xmax = numpy.nanmax(x) |
|
383 | 383 | if ymin == None: ymin = numpy.nanmin(y) |
|
384 | 384 | if ymax == None: ymax = numpy.nanmax(y) |
|
385 | 385 | |
|
386 | 386 | self.plot = self.__driver.createPmultiline(self.ax, x, y, |
|
387 | 387 | xmin, xmax, |
|
388 | 388 | ymin, ymax, |
|
389 | 389 | xlabel=xlabel, |
|
390 | 390 | ylabel=ylabel, |
|
391 | 391 | title=title, |
|
392 | 392 | **kwargs) |
|
393 | 393 | self.__firsttime = False |
|
394 | 394 | return |
|
395 | 395 | |
|
396 | 396 | self.__driver.pmultiline(self.plot, x, y, xlabel=xlabel, |
|
397 | 397 | ylabel=ylabel, |
|
398 | 398 | title=title) |
|
399 | 399 | |
|
400 | 400 | def pmultilineyaxis(self, x, y, |
|
401 | 401 | xmin=None, xmax=None, |
|
402 | 402 | ymin=None, ymax=None, |
|
403 | 403 | xlabel='', ylabel='', |
|
404 | 404 | title='', |
|
405 | 405 | **kwargs): |
|
406 | 406 | |
|
407 | 407 | if self.__firsttime: |
|
408 | 408 | |
|
409 | 409 | if xmin == None: xmin = numpy.nanmin(x) |
|
410 | 410 | if xmax == None: xmax = numpy.nanmax(x) |
|
411 | 411 | if ymin == None: ymin = numpy.nanmin(y) |
|
412 | 412 | if ymax == None: ymax = numpy.nanmax(y) |
|
413 | 413 | |
|
414 | 414 | self.plot = self.__driver.createPmultilineYAxis(self.ax, x, y, |
|
415 | 415 | xmin, xmax, |
|
416 | 416 | ymin, ymax, |
|
417 | 417 | xlabel=xlabel, |
|
418 | 418 | ylabel=ylabel, |
|
419 | 419 | title=title, |
|
420 | 420 | **kwargs) |
|
421 | 421 | if self.xmin == None: self.xmin = xmin |
|
422 | 422 | if self.xmax == None: self.xmax = xmax |
|
423 | 423 | if self.ymin == None: self.ymin = ymin |
|
424 | 424 | if self.ymax == None: self.ymax = ymax |
|
425 | 425 | |
|
426 | 426 | self.__firsttime = False |
|
427 | 427 | return |
|
428 | 428 | |
|
429 | 429 | self.__driver.pmultilineyaxis(self.plot, x, y, xlabel=xlabel, |
|
430 | 430 | ylabel=ylabel, |
|
431 | 431 | title=title) |
|
432 | 432 | |
|
433 | 433 | def pcolor(self, x, y, z, |
|
434 | 434 | xmin=None, xmax=None, |
|
435 | 435 | ymin=None, ymax=None, |
|
436 | 436 | zmin=None, zmax=None, |
|
437 | 437 | xlabel='', ylabel='', |
|
438 | 438 | title='', rti = False, colormap='jet', |
|
439 | 439 | **kwargs): |
|
440 | 440 | |
|
441 | 441 | """ |
|
442 | 442 | Input: |
|
443 | 443 | x : |
|
444 | 444 | y : |
|
445 | 445 | x : |
|
446 | 446 | xmin : |
|
447 | 447 | xmax : |
|
448 | 448 | ymin : |
|
449 | 449 | ymax : |
|
450 | 450 | zmin : |
|
451 | 451 | zmax : |
|
452 | 452 | xlabel : |
|
453 | 453 | ylabel : |
|
454 | 454 | title : |
|
455 | 455 | **kwargs : Los parametros aceptados son |
|
456 | 456 | ticksize=9, |
|
457 | 457 | cblabel='' |
|
458 | 458 | rti = True or False |
|
459 | 459 | """ |
|
460 | 460 | |
|
461 | 461 | if self.__firsttime: |
|
462 | 462 | |
|
463 | 463 | if xmin == None: xmin = numpy.nanmin(x) |
|
464 | 464 | if xmax == None: xmax = numpy.nanmax(x) |
|
465 | 465 | if ymin == None: ymin = numpy.nanmin(y) |
|
466 | 466 | if ymax == None: ymax = numpy.nanmax(y) |
|
467 | 467 | if zmin == None: zmin = numpy.nanmin(z) |
|
468 | 468 | if zmax == None: zmax = numpy.nanmax(z) |
|
469 | 469 | |
|
470 | 470 | |
|
471 | 471 | self.plot = self.__driver.createPcolor(self.ax, x, y, z, |
|
472 | 472 | xmin, xmax, |
|
473 | 473 | ymin, ymax, |
|
474 | 474 | zmin, zmax, |
|
475 | 475 | xlabel=xlabel, |
|
476 | 476 | ylabel=ylabel, |
|
477 | 477 | title=title, |
|
478 | 478 | colormap=colormap, |
|
479 | 479 | **kwargs) |
|
480 | 480 | |
|
481 | 481 | if self.xmin == None: self.xmin = xmin |
|
482 | 482 | if self.xmax == None: self.xmax = xmax |
|
483 | 483 | if self.ymin == None: self.ymin = ymin |
|
484 | 484 | if self.ymax == None: self.ymax = ymax |
|
485 | 485 | if self.zmin == None: self.zmin = zmin |
|
486 | 486 | if self.zmax == None: self.zmax = zmax |
|
487 | 487 | |
|
488 | 488 | self.__firsttime = False |
|
489 | 489 | return |
|
490 | 490 | |
|
491 | 491 | if rti: |
|
492 | 492 | self.__driver.addpcolor(self.ax, x, y, z, self.zmin, self.zmax, |
|
493 | 493 | xlabel=xlabel, |
|
494 | 494 | ylabel=ylabel, |
|
495 | 495 | title=title, |
|
496 | 496 | colormap=colormap) |
|
497 | 497 | return |
|
498 | 498 | |
|
499 | 499 | self.__driver.pcolor(self.plot, z, |
|
500 | 500 | xlabel=xlabel, |
|
501 | 501 | ylabel=ylabel, |
|
502 | 502 | title=title) |
|
503 | 503 | |
|
504 | 504 | def pcolorbuffer(self, x, y, z, |
|
505 | 505 | xmin=None, xmax=None, |
|
506 | 506 | ymin=None, ymax=None, |
|
507 | 507 | zmin=None, zmax=None, |
|
508 | 508 | xlabel='', ylabel='', |
|
509 | 509 | title='', rti = True, colormap='jet', |
|
510 | 510 | maxNumX = None, maxNumY = None, |
|
511 | 511 | **kwargs): |
|
512 | 512 | |
|
513 | 513 | if maxNumX == None: |
|
514 | 514 | maxNumX = self.__MAXNUMX |
|
515 | 515 | |
|
516 | 516 | if maxNumY == None: |
|
517 | 517 | maxNumY = self.__MAXNUMY |
|
518 | 518 | |
|
519 | 519 | if self.__firsttime: |
|
520 | 520 | self.z_buffer = z |
|
521 | 521 | self.x_buffer = numpy.hstack((self.x_buffer, x)) |
|
522 | 522 | |
|
523 | 523 | if xmin == None: xmin = numpy.nanmin(x) |
|
524 | 524 | if xmax == None: xmax = numpy.nanmax(x) |
|
525 | 525 | if ymin == None: ymin = numpy.nanmin(y) |
|
526 | 526 | if ymax == None: ymax = numpy.nanmax(y) |
|
527 | 527 | if zmin == None: zmin = numpy.nanmin(z) |
|
528 | 528 | if zmax == None: zmax = numpy.nanmax(z) |
|
529 | 529 | |
|
530 | 530 | |
|
531 | 531 | self.plot = self.__driver.createPcolor(self.ax, self.x_buffer, y, z, |
|
532 | 532 | xmin, xmax, |
|
533 | 533 | ymin, ymax, |
|
534 | 534 | zmin, zmax, |
|
535 | 535 | xlabel=xlabel, |
|
536 | 536 | ylabel=ylabel, |
|
537 | 537 | title=title, |
|
538 | 538 | colormap=colormap, |
|
539 | 539 | **kwargs) |
|
540 | 540 | |
|
541 | 541 | if self.xmin == None: self.xmin = xmin |
|
542 | 542 | if self.xmax == None: self.xmax = xmax |
|
543 | 543 | if self.ymin == None: self.ymin = ymin |
|
544 | 544 | if self.ymax == None: self.ymax = ymax |
|
545 | 545 | if self.zmin == None: self.zmin = zmin |
|
546 | 546 | if self.zmax == None: self.zmax = zmax |
|
547 | 547 | |
|
548 | 548 | self.__firsttime = False |
|
549 | 549 | return |
|
550 | 550 | |
|
551 | 551 | self.x_buffer = numpy.hstack((self.x_buffer, x[-1])) |
|
552 | 552 | self.z_buffer = numpy.hstack((self.z_buffer, z)) |
|
553 | 553 | |
|
554 | 554 | if self.decimationx == None: |
|
555 | 555 | deltax = float(self.xmax - self.xmin)/maxNumX |
|
556 | 556 | deltay = float(self.ymax - self.ymin)/maxNumY |
|
557 | 557 | |
|
558 | 558 | resolutionx = self.x_buffer[2]-self.x_buffer[0] |
|
559 | 559 | resolutiony = y[1]-y[0] |
|
560 | 560 | |
|
561 | 561 | self.decimationx = numpy.ceil(deltax / resolutionx) |
|
562 | 562 | self.decimationy = numpy.ceil(deltay / resolutiony) |
|
563 | 563 | |
|
564 | 564 | z_buffer = self.z_buffer.reshape(-1,len(y)) |
|
565 | 565 | |
|
566 | 566 | x_buffer = self.x_buffer[::self.decimationx] |
|
567 | 567 | y_buffer = y[::self.decimationy] |
|
568 | 568 | z_buffer = z_buffer[::self.decimationx, ::self.decimationy] |
|
569 | 569 | #=================================================== |
|
570 | 570 | |
|
571 | 571 | x_buffer, y_buffer, z_buffer = self.__fillGaps(x_buffer, y_buffer, z_buffer) |
|
572 | 572 | |
|
573 | 573 | self.__driver.addpcolorbuffer(self.ax, x_buffer, y_buffer, z_buffer, self.zmin, self.zmax, |
|
574 | 574 | xlabel=xlabel, |
|
575 | 575 | ylabel=ylabel, |
|
576 | 576 | title=title, |
|
577 | 577 | colormap=colormap) |
|
578 | 578 | |
|
579 | 579 | def polar(self, x, y, |
|
580 | 580 | title='', xlabel='',ylabel='',**kwargs): |
|
581 | 581 | |
|
582 | 582 | if self.__firsttime: |
|
583 | 583 | self.plot = self.__driver.createPolar(self.ax, x, y, title = title, xlabel = xlabel, ylabel = ylabel) |
|
584 | 584 | self.__firsttime = False |
|
585 | 585 | self.x_buffer = x |
|
586 | 586 | self.y_buffer = y |
|
587 | 587 | return |
|
588 | 588 | |
|
589 | 589 | self.x_buffer = numpy.hstack((self.x_buffer,x)) |
|
590 | 590 | self.y_buffer = numpy.hstack((self.y_buffer,y)) |
|
591 | 591 | self.__driver.polar(self.plot, self.x_buffer, self.y_buffer, xlabel=xlabel, |
|
592 | 592 | ylabel=ylabel, |
|
593 | 593 | title=title) |
|
594 | 594 | |
|
595 | 595 | def __fillGaps(self, x_buffer, y_buffer, z_buffer): |
|
596 | 596 | |
|
597 | 597 | deltas = x_buffer[1:] - x_buffer[0:-1] |
|
598 | 598 | x_median = numpy.median(deltas) |
|
599 | 599 | |
|
600 | 600 | index = numpy.where(deltas >= 2*x_median) |
|
601 | 601 | |
|
602 | 602 | if len(index[0]) != 0: |
|
603 | 603 | z_buffer[index[0],::] = self.__missing |
|
604 | 604 | z_buffer = numpy.ma.masked_inside(z_buffer,0.99*self.__missing,1.01*self.__missing) |
|
605 | 605 | |
|
606 | 606 | return x_buffer, y_buffer, z_buffer |
|
607 | 607 | |
|
608 | 608 | |
|
609 | 609 | |
|
610 | 610 | No newline at end of file |
@@ -1,1327 +1,1337 | |||
|
1 | 1 | ''' |
|
2 | 2 | Created on Jul 9, 2014 |
|
3 | 3 | |
|
4 | 4 | @author: roj-idl71 |
|
5 | 5 | ''' |
|
6 | 6 | import os |
|
7 | 7 | import datetime |
|
8 | 8 | import numpy |
|
9 | 9 | |
|
10 | 10 | from figure import Figure, isRealtime |
|
11 | 11 | from plotting_codes import * |
|
12 | 12 | |
|
13 | 13 | class SpectraPlot(Figure): |
|
14 | 14 | |
|
15 | 15 | isConfig = None |
|
16 | 16 | __nsubplots = None |
|
17 | 17 | |
|
18 | 18 | WIDTHPROF = None |
|
19 | 19 | HEIGHTPROF = None |
|
20 | 20 | PREFIX = 'spc' |
|
21 | 21 | |
|
22 | 22 | def __init__(self): |
|
23 | 23 | |
|
24 | 24 | self.isConfig = False |
|
25 | 25 | self.__nsubplots = 1 |
|
26 | 26 | |
|
27 | 27 | self.WIDTH = 280 |
|
28 | 28 | self.HEIGHT = 250 |
|
29 | 29 | self.WIDTHPROF = 120 |
|
30 | 30 | self.HEIGHTPROF = 0 |
|
31 | 31 | self.counter_imagwr = 0 |
|
32 | 32 | |
|
33 | 33 | self.PLOT_CODE = SPEC_CODE |
|
34 | 34 | |
|
35 | 35 | self.FTP_WEI = None |
|
36 | 36 | self.EXP_CODE = None |
|
37 | 37 | self.SUB_EXP_CODE = None |
|
38 | 38 | self.PLOT_POS = None |
|
39 | 39 | |
|
40 | 40 | self.__xfilter_ena = False |
|
41 | 41 | self.__yfilter_ena = False |
|
42 | 42 | |
|
43 | 43 | def getSubplots(self): |
|
44 | 44 | |
|
45 | 45 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
46 | 46 | nrow = int(self.nplots*1./ncol + 0.9) |
|
47 | 47 | |
|
48 | 48 | return nrow, ncol |
|
49 | 49 | |
|
50 | 50 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
51 | 51 | |
|
52 | 52 | self.__showprofile = showprofile |
|
53 | 53 | self.nplots = nplots |
|
54 | 54 | |
|
55 | 55 | ncolspan = 1 |
|
56 | 56 | colspan = 1 |
|
57 | 57 | if showprofile: |
|
58 | 58 | ncolspan = 3 |
|
59 | 59 | colspan = 2 |
|
60 | 60 | self.__nsubplots = 2 |
|
61 | 61 | |
|
62 | 62 | self.createFigure(id = id, |
|
63 | 63 | wintitle = wintitle, |
|
64 | 64 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
65 | 65 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
66 | 66 | show=show) |
|
67 | 67 | |
|
68 | 68 | nrow, ncol = self.getSubplots() |
|
69 | 69 | |
|
70 | 70 | counter = 0 |
|
71 | 71 | for y in range(nrow): |
|
72 | 72 | for x in range(ncol): |
|
73 | 73 | |
|
74 | 74 | if counter >= self.nplots: |
|
75 | 75 | break |
|
76 | 76 | |
|
77 | 77 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
78 | 78 | |
|
79 | 79 | if showprofile: |
|
80 | 80 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
81 | 81 | |
|
82 | 82 | counter += 1 |
|
83 | 83 | |
|
84 | 84 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True, |
|
85 | 85 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
86 | 86 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
87 | 87 | server=None, folder=None, username=None, password=None, |
|
88 | 88 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False): |
|
89 | 89 | |
|
90 | 90 | """ |
|
91 | 91 | |
|
92 | 92 | Input: |
|
93 | 93 | dataOut : |
|
94 | 94 | id : |
|
95 | 95 | wintitle : |
|
96 | 96 | channelList : |
|
97 | 97 | showProfile : |
|
98 | 98 | xmin : None, |
|
99 | 99 | xmax : None, |
|
100 | 100 | ymin : None, |
|
101 | 101 | ymax : None, |
|
102 | 102 | zmin : None, |
|
103 | 103 | zmax : None |
|
104 | 104 | """ |
|
105 | 105 | |
|
106 | 106 | if realtime: |
|
107 | 107 | if not(isRealtime(utcdatatime = dataOut.utctime)): |
|
108 | 108 | print 'Skipping this plot function' |
|
109 | 109 | return |
|
110 | 110 | |
|
111 | 111 | if channelList == None: |
|
112 | 112 | channelIndexList = dataOut.channelIndexList |
|
113 | 113 | else: |
|
114 | 114 | channelIndexList = [] |
|
115 | 115 | for channel in channelList: |
|
116 | 116 | if channel not in dataOut.channelList: |
|
117 | 117 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
118 | 118 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
119 | 119 | |
|
120 | 120 | factor = dataOut.normFactor |
|
121 | 121 | |
|
122 | 122 | x = dataOut.getVelRange(1) |
|
123 | 123 | y = dataOut.getHeiRange() |
|
124 | 124 | |
|
125 | 125 | z = dataOut.data_spc[channelIndexList,:,:]/factor |
|
126 | 126 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
127 | 127 | zdB = 10*numpy.log10(z) |
|
128 | 128 | |
|
129 | 129 | avg = numpy.average(z, axis=1) |
|
130 | 130 | avgdB = 10*numpy.log10(avg) |
|
131 | 131 | |
|
132 | 132 | noise = dataOut.getNoise()/factor |
|
133 | 133 | noisedB = 10*numpy.log10(noise) |
|
134 | 134 | |
|
135 | 135 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
136 | 136 | title = wintitle + " Spectra" |
|
137 | 137 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
138 | 138 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
139 | 139 | |
|
140 | 140 | xlabel = "Velocity (m/s)" |
|
141 | 141 | ylabel = "Range (Km)" |
|
142 | 142 | |
|
143 | 143 | if not self.isConfig: |
|
144 | 144 | |
|
145 | 145 | nplots = len(channelIndexList) |
|
146 | 146 | |
|
147 | 147 | self.setup(id=id, |
|
148 | 148 | nplots=nplots, |
|
149 | 149 | wintitle=wintitle, |
|
150 | 150 | showprofile=showprofile, |
|
151 | 151 | show=show) |
|
152 | 152 | |
|
153 | 153 | if xmin == None: xmin = numpy.nanmin(x) |
|
154 | 154 | if xmax == None: xmax = numpy.nanmax(x) |
|
155 | 155 | if ymin == None: ymin = numpy.nanmin(y) |
|
156 | 156 | if ymax == None: ymax = numpy.nanmax(y) |
|
157 | 157 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
158 | 158 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
159 | 159 | |
|
160 | 160 | self.FTP_WEI = ftp_wei |
|
161 | 161 | self.EXP_CODE = exp_code |
|
162 | 162 | self.SUB_EXP_CODE = sub_exp_code |
|
163 | 163 | self.PLOT_POS = plot_pos |
|
164 | 164 | |
|
165 | 165 | self.isConfig = True |
|
166 | 166 | |
|
167 | 167 | self.setWinTitle(title) |
|
168 | 168 | |
|
169 | 169 | for i in range(self.nplots): |
|
170 | 170 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
171 | 171 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i]+1, noisedB[i], str_datetime) |
|
172 | 172 | if len(dataOut.beam.codeList) != 0: |
|
173 | 173 | title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[i]+1, noisedB[i], dataOut.beam.azimuthList[i], dataOut.beam.zenithList[i], str_datetime) |
|
174 | 174 | |
|
175 | 175 | axes = self.axesList[i*self.__nsubplots] |
|
176 | 176 | axes.pcolor(x, y, zdB[i,:,:], |
|
177 | 177 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
178 | 178 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
179 | 179 | ticksize=9, cblabel='') |
|
180 | 180 | |
|
181 | 181 | if self.__showprofile: |
|
182 | 182 | axes = self.axesList[i*self.__nsubplots +1] |
|
183 | 183 | axes.pline(avgdB[i,:], y, |
|
184 | 184 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
185 | 185 | xlabel='dB', ylabel='', title='', |
|
186 | 186 | ytick_visible=False, |
|
187 | 187 | grid='x') |
|
188 | 188 | |
|
189 | 189 | noiseline = numpy.repeat(noisedB[i], len(y)) |
|
190 | 190 | axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2) |
|
191 | 191 | |
|
192 | 192 | self.draw() |
|
193 | 193 | |
|
194 | 194 | if figfile == None: |
|
195 | 195 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
196 | 196 | name = str_datetime |
|
197 | 197 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
198 | 198 | name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) |
|
199 | 199 | figfile = self.getFilename(name) |
|
200 | 200 | |
|
201 | 201 | self.save(figpath=figpath, |
|
202 | 202 | figfile=figfile, |
|
203 | 203 | save=save, |
|
204 | 204 | ftp=ftp, |
|
205 | 205 | wr_period=wr_period, |
|
206 | 206 | thisDatetime=thisDatetime) |
|
207 | 207 | |
|
208 | 208 | class CrossSpectraPlot(Figure): |
|
209 | 209 | |
|
210 | 210 | isConfig = None |
|
211 | 211 | __nsubplots = None |
|
212 | 212 | |
|
213 | 213 | WIDTH = None |
|
214 | 214 | HEIGHT = None |
|
215 | 215 | WIDTHPROF = None |
|
216 | 216 | HEIGHTPROF = None |
|
217 | 217 | PREFIX = 'cspc' |
|
218 | 218 | |
|
219 | 219 | def __init__(self): |
|
220 | 220 | |
|
221 | 221 | self.isConfig = False |
|
222 | 222 | self.__nsubplots = 4 |
|
223 | 223 | self.counter_imagwr = 0 |
|
224 | 224 | self.WIDTH = 250 |
|
225 | 225 | self.HEIGHT = 250 |
|
226 | 226 | self.WIDTHPROF = 0 |
|
227 | 227 | self.HEIGHTPROF = 0 |
|
228 | 228 | |
|
229 | 229 | self.PLOT_CODE = CROSS_CODE |
|
230 | 230 | self.FTP_WEI = None |
|
231 | 231 | self.EXP_CODE = None |
|
232 | 232 | self.SUB_EXP_CODE = None |
|
233 | 233 | self.PLOT_POS = None |
|
234 | 234 | |
|
235 | 235 | def getSubplots(self): |
|
236 | 236 | |
|
237 | 237 | ncol = 4 |
|
238 | 238 | nrow = self.nplots |
|
239 | 239 | |
|
240 | 240 | return nrow, ncol |
|
241 | 241 | |
|
242 | 242 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
243 | 243 | |
|
244 | 244 | self.__showprofile = showprofile |
|
245 | 245 | self.nplots = nplots |
|
246 | 246 | |
|
247 | 247 | ncolspan = 1 |
|
248 | 248 | colspan = 1 |
|
249 | 249 | |
|
250 | 250 | self.createFigure(id = id, |
|
251 | 251 | wintitle = wintitle, |
|
252 | 252 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
253 | 253 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
254 | 254 | show=True) |
|
255 | 255 | |
|
256 | 256 | nrow, ncol = self.getSubplots() |
|
257 | 257 | |
|
258 | 258 | counter = 0 |
|
259 | 259 | for y in range(nrow): |
|
260 | 260 | for x in range(ncol): |
|
261 | 261 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
262 | 262 | |
|
263 | 263 | counter += 1 |
|
264 | 264 | |
|
265 | 265 | def run(self, dataOut, id, wintitle="", pairsList=None, |
|
266 | 266 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
267 | coh_min=None, coh_max=None, phase_min=None, phase_max=None, | |
|
267 | 268 | save=False, figpath='./', figfile=None, ftp=False, wr_period=1, |
|
268 | 269 | power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True, |
|
269 | 270 | server=None, folder=None, username=None, password=None, |
|
270 | 271 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
271 | 272 | |
|
272 | 273 | """ |
|
273 | 274 | |
|
274 | 275 | Input: |
|
275 | 276 | dataOut : |
|
276 | 277 | id : |
|
277 | 278 | wintitle : |
|
278 | 279 | channelList : |
|
279 | 280 | showProfile : |
|
280 | 281 | xmin : None, |
|
281 | 282 | xmax : None, |
|
282 | 283 | ymin : None, |
|
283 | 284 | ymax : None, |
|
284 | 285 | zmin : None, |
|
285 | 286 | zmax : None |
|
286 | 287 | """ |
|
287 | 288 | |
|
288 | 289 | if pairsList == None: |
|
289 | 290 | pairsIndexList = dataOut.pairsIndexList |
|
290 | 291 | else: |
|
291 | 292 | pairsIndexList = [] |
|
292 | 293 | for pair in pairsList: |
|
293 | 294 | if pair not in dataOut.pairsList: |
|
294 | 295 | raise ValueError, "Pair %s is not in dataOut.pairsList" %str(pair) |
|
295 | 296 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
296 | 297 | |
|
297 | 298 | if not pairsIndexList: |
|
298 | 299 | return |
|
299 | 300 | |
|
300 | 301 | if len(pairsIndexList) > 4: |
|
301 | 302 | pairsIndexList = pairsIndexList[0:4] |
|
302 | 303 | |
|
303 | 304 | factor = dataOut.normFactor |
|
304 | 305 | x = dataOut.getVelRange(1) |
|
305 | 306 | y = dataOut.getHeiRange() |
|
306 | 307 | z = dataOut.data_spc[:,:,:]/factor |
|
307 | 308 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
308 | 309 | |
|
309 | 310 | noise = dataOut.noise/factor |
|
310 | 311 | |
|
311 | 312 | zdB = 10*numpy.log10(z) |
|
312 | 313 | noisedB = 10*numpy.log10(noise) |
|
313 | 314 | |
|
315 | if coh_min == None: | |
|
316 | coh_min = 0.0 | |
|
317 | if coh_max == None: | |
|
318 | coh_max = 1.0 | |
|
314 | 319 | |
|
320 | if phase_min == None: | |
|
321 | phase_min = -180 | |
|
322 | if phase_max == None: | |
|
323 | phase_max = 180 | |
|
324 | ||
|
315 | 325 | #thisDatetime = dataOut.datatime |
|
316 | 326 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
317 | 327 | title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
318 | 328 | xlabel = "Velocity (m/s)" |
|
319 | 329 | ylabel = "Range (Km)" |
|
320 | 330 | |
|
321 | 331 | if not self.isConfig: |
|
322 | 332 | |
|
323 | 333 | nplots = len(pairsIndexList) |
|
324 | 334 | |
|
325 | 335 | self.setup(id=id, |
|
326 | 336 | nplots=nplots, |
|
327 | 337 | wintitle=wintitle, |
|
328 | 338 | showprofile=False, |
|
329 | 339 | show=show) |
|
330 | 340 | |
|
331 | 341 | avg = numpy.abs(numpy.average(z, axis=1)) |
|
332 | 342 | avgdB = 10*numpy.log10(avg) |
|
333 | 343 | |
|
334 | 344 | if xmin == None: xmin = numpy.nanmin(x) |
|
335 | 345 | if xmax == None: xmax = numpy.nanmax(x) |
|
336 | 346 | if ymin == None: ymin = numpy.nanmin(y) |
|
337 | 347 | if ymax == None: ymax = numpy.nanmax(y) |
|
338 | 348 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
339 | 349 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
340 | 350 | |
|
341 | 351 | self.FTP_WEI = ftp_wei |
|
342 | 352 | self.EXP_CODE = exp_code |
|
343 | 353 | self.SUB_EXP_CODE = sub_exp_code |
|
344 | 354 | self.PLOT_POS = plot_pos |
|
345 | 355 | |
|
346 | 356 | self.isConfig = True |
|
347 | 357 | |
|
348 | 358 | self.setWinTitle(title) |
|
349 | 359 | |
|
350 | 360 | for i in range(self.nplots): |
|
351 | 361 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
352 | 362 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
353 | 363 | title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[pair[0]], str_datetime) |
|
354 | 364 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:]/factor) |
|
355 | 365 | axes0 = self.axesList[i*self.__nsubplots] |
|
356 | 366 | axes0.pcolor(x, y, zdB, |
|
357 | 367 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
358 | 368 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
359 | 369 | ticksize=9, colormap=power_cmap, cblabel='') |
|
360 | 370 | |
|
361 | 371 | title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[pair[1]], str_datetime) |
|
362 | 372 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor) |
|
363 | 373 | axes0 = self.axesList[i*self.__nsubplots+1] |
|
364 | 374 | axes0.pcolor(x, y, zdB, |
|
365 | 375 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
366 | 376 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
367 | 377 | ticksize=9, colormap=power_cmap, cblabel='') |
|
368 | 378 | |
|
369 | 379 | coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:]) |
|
370 | 380 | coherence = numpy.abs(coherenceComplex) |
|
371 | 381 | # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi |
|
372 | 382 | phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi |
|
373 | 383 | |
|
374 | 384 | title = "Coherence %d%d" %(pair[0], pair[1]) |
|
375 | 385 | axes0 = self.axesList[i*self.__nsubplots+2] |
|
376 | 386 | axes0.pcolor(x, y, coherence, |
|
377 |
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin= |
|
|
387 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=coh_min, zmax=coh_max, | |
|
378 | 388 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
379 | 389 | ticksize=9, colormap=coherence_cmap, cblabel='') |
|
380 | 390 | |
|
381 | 391 | title = "Phase %d%d" %(pair[0], pair[1]) |
|
382 | 392 | axes0 = self.axesList[i*self.__nsubplots+3] |
|
383 | 393 | axes0.pcolor(x, y, phase, |
|
384 |
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin= |
|
|
394 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max, | |
|
385 | 395 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
386 | 396 | ticksize=9, colormap=phase_cmap, cblabel='') |
|
387 | 397 | |
|
388 | 398 | |
|
389 | 399 | |
|
390 | 400 | self.draw() |
|
391 | 401 | |
|
392 | 402 | self.save(figpath=figpath, |
|
393 | 403 | figfile=figfile, |
|
394 | 404 | save=save, |
|
395 | 405 | ftp=ftp, |
|
396 | 406 | wr_period=wr_period, |
|
397 | 407 | thisDatetime=thisDatetime) |
|
398 | 408 | |
|
399 | 409 | |
|
400 | 410 | class RTIPlot(Figure): |
|
401 | 411 | |
|
402 | 412 | __isConfig = None |
|
403 | 413 | __nsubplots = None |
|
404 | 414 | |
|
405 | 415 | WIDTHPROF = None |
|
406 | 416 | HEIGHTPROF = None |
|
407 | 417 | PREFIX = 'rti' |
|
408 | 418 | |
|
409 | 419 | def __init__(self): |
|
410 | 420 | |
|
411 | 421 | self.timerange = None |
|
412 | 422 | self.__isConfig = False |
|
413 | 423 | self.__nsubplots = 1 |
|
414 | 424 | |
|
415 | 425 | self.WIDTH = 800 |
|
416 | 426 | self.HEIGHT = 150 |
|
417 | 427 | self.WIDTHPROF = 120 |
|
418 | 428 | self.HEIGHTPROF = 0 |
|
419 | 429 | self.counter_imagwr = 0 |
|
420 | 430 | |
|
421 | 431 | self.PLOT_CODE = RTI_CODE |
|
422 | 432 | |
|
423 | 433 | self.FTP_WEI = None |
|
424 | 434 | self.EXP_CODE = None |
|
425 | 435 | self.SUB_EXP_CODE = None |
|
426 | 436 | self.PLOT_POS = None |
|
427 | 437 | self.tmin = None |
|
428 | 438 | self.tmax = None |
|
429 | 439 | |
|
430 | 440 | self.xmin = None |
|
431 | 441 | self.xmax = None |
|
432 | 442 | |
|
433 | 443 | self.figfile = None |
|
434 | 444 | |
|
435 | 445 | def getSubplots(self): |
|
436 | 446 | |
|
437 | 447 | ncol = 1 |
|
438 | 448 | nrow = self.nplots |
|
439 | 449 | |
|
440 | 450 | return nrow, ncol |
|
441 | 451 | |
|
442 | 452 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
443 | 453 | |
|
444 | 454 | self.__showprofile = showprofile |
|
445 | 455 | self.nplots = nplots |
|
446 | 456 | |
|
447 | 457 | ncolspan = 1 |
|
448 | 458 | colspan = 1 |
|
449 | 459 | if showprofile: |
|
450 | 460 | ncolspan = 7 |
|
451 | 461 | colspan = 6 |
|
452 | 462 | self.__nsubplots = 2 |
|
453 | 463 | |
|
454 | 464 | self.createFigure(id = id, |
|
455 | 465 | wintitle = wintitle, |
|
456 | 466 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
457 | 467 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
458 | 468 | show=show) |
|
459 | 469 | |
|
460 | 470 | nrow, ncol = self.getSubplots() |
|
461 | 471 | |
|
462 | 472 | counter = 0 |
|
463 | 473 | for y in range(nrow): |
|
464 | 474 | for x in range(ncol): |
|
465 | 475 | |
|
466 | 476 | if counter >= self.nplots: |
|
467 | 477 | break |
|
468 | 478 | |
|
469 | 479 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
470 | 480 | |
|
471 | 481 | if showprofile: |
|
472 | 482 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
473 | 483 | |
|
474 | 484 | counter += 1 |
|
475 | 485 | |
|
476 | 486 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True', |
|
477 | 487 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
478 | 488 | timerange=None, |
|
479 | 489 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
480 | 490 | server=None, folder=None, username=None, password=None, |
|
481 | 491 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
482 | 492 | |
|
483 | 493 | """ |
|
484 | 494 | |
|
485 | 495 | Input: |
|
486 | 496 | dataOut : |
|
487 | 497 | id : |
|
488 | 498 | wintitle : |
|
489 | 499 | channelList : |
|
490 | 500 | showProfile : |
|
491 | 501 | xmin : None, |
|
492 | 502 | xmax : None, |
|
493 | 503 | ymin : None, |
|
494 | 504 | ymax : None, |
|
495 | 505 | zmin : None, |
|
496 | 506 | zmax : None |
|
497 | 507 | """ |
|
498 | 508 | |
|
499 | 509 | if channelList == None: |
|
500 | 510 | channelIndexList = dataOut.channelIndexList |
|
501 | 511 | else: |
|
502 | 512 | channelIndexList = [] |
|
503 | 513 | for channel in channelList: |
|
504 | 514 | if channel not in dataOut.channelList: |
|
505 | 515 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
506 | 516 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
507 | 517 | |
|
508 | 518 | # if timerange != None: |
|
509 | 519 | # self.timerange = timerange |
|
510 | 520 | |
|
511 | 521 | #tmin = None |
|
512 | 522 | #tmax = None |
|
513 | 523 | factor = dataOut.normFactor |
|
514 | 524 | x = dataOut.getTimeRange() |
|
515 | 525 | y = dataOut.getHeiRange() |
|
516 | 526 | |
|
517 | 527 | z = dataOut.data_spc[channelIndexList,:,:]/factor |
|
518 | 528 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
519 | 529 | avg = numpy.average(z, axis=1) |
|
520 | 530 | |
|
521 | 531 | avgdB = 10.*numpy.log10(avg) |
|
522 | 532 | |
|
523 | 533 | |
|
524 | 534 | # thisDatetime = dataOut.datatime |
|
525 | 535 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
526 | 536 | title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
527 | 537 | xlabel = "" |
|
528 | 538 | ylabel = "Range (Km)" |
|
529 | 539 | |
|
530 | 540 | if not self.__isConfig: |
|
531 | 541 | |
|
532 | 542 | nplots = len(channelIndexList) |
|
533 | 543 | |
|
534 | 544 | self.setup(id=id, |
|
535 | 545 | nplots=nplots, |
|
536 | 546 | wintitle=wintitle, |
|
537 | 547 | showprofile=showprofile, |
|
538 | 548 | show=show) |
|
539 | 549 | |
|
540 | 550 | if timerange != None: |
|
541 | 551 | self.timerange = timerange |
|
542 | 552 | |
|
543 | 553 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
544 | 554 | |
|
545 | 555 | noise = dataOut.noise/factor |
|
546 | 556 | noisedB = 10*numpy.log10(noise) |
|
547 | 557 | |
|
548 | 558 | if ymin == None: ymin = numpy.nanmin(y) |
|
549 | 559 | if ymax == None: ymax = numpy.nanmax(y) |
|
550 | 560 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
551 | 561 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
552 | 562 | |
|
553 | 563 | self.FTP_WEI = ftp_wei |
|
554 | 564 | self.EXP_CODE = exp_code |
|
555 | 565 | self.SUB_EXP_CODE = sub_exp_code |
|
556 | 566 | self.PLOT_POS = plot_pos |
|
557 | 567 | |
|
558 | 568 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
559 | 569 | self.__isConfig = True |
|
560 | 570 | self.figfile = figfile |
|
561 | 571 | |
|
562 | 572 | self.setWinTitle(title) |
|
563 | 573 | |
|
564 | 574 | if ((self.xmax - x[1]) < (x[1]-x[0])): |
|
565 | 575 | x[1] = self.xmax |
|
566 | 576 | |
|
567 | 577 | for i in range(self.nplots): |
|
568 | 578 | title = "Channel %d: %s" %(dataOut.channelList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
569 | 579 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
570 | 580 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
571 | 581 | axes = self.axesList[i*self.__nsubplots] |
|
572 | 582 | zdB = avgdB[i].reshape((1,-1)) |
|
573 | 583 | axes.pcolorbuffer(x, y, zdB, |
|
574 | 584 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
575 | 585 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
576 | 586 | ticksize=9, cblabel='', cbsize="1%") |
|
577 | 587 | |
|
578 | 588 | if self.__showprofile: |
|
579 | 589 | axes = self.axesList[i*self.__nsubplots +1] |
|
580 | 590 | axes.pline(avgdB[i], y, |
|
581 | 591 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
582 | 592 | xlabel='dB', ylabel='', title='', |
|
583 | 593 | ytick_visible=False, |
|
584 | 594 | grid='x') |
|
585 | 595 | |
|
586 | 596 | self.draw() |
|
587 | 597 | |
|
588 | 598 | if x[1] >= self.axesList[0].xmax: |
|
589 | 599 | self.counter_imagwr = wr_period |
|
590 | 600 | self.__isConfig = False |
|
591 | 601 | self.figfile = None |
|
592 | 602 | |
|
593 | 603 | self.save(figpath=figpath, |
|
594 | 604 | figfile=figfile, |
|
595 | 605 | save=save, |
|
596 | 606 | ftp=ftp, |
|
597 | 607 | wr_period=wr_period, |
|
598 | 608 | thisDatetime=thisDatetime, |
|
599 | 609 | update_figfile=False) |
|
600 | 610 | |
|
601 | 611 | class CoherenceMap(Figure): |
|
602 | 612 | isConfig = None |
|
603 | 613 | __nsubplots = None |
|
604 | 614 | |
|
605 | 615 | WIDTHPROF = None |
|
606 | 616 | HEIGHTPROF = None |
|
607 | 617 | PREFIX = 'cmap' |
|
608 | 618 | |
|
609 | 619 | def __init__(self): |
|
610 | 620 | self.timerange = 2*60*60 |
|
611 | 621 | self.isConfig = False |
|
612 | 622 | self.__nsubplots = 1 |
|
613 | 623 | |
|
614 | 624 | self.WIDTH = 800 |
|
615 | 625 | self.HEIGHT = 150 |
|
616 | 626 | self.WIDTHPROF = 120 |
|
617 | 627 | self.HEIGHTPROF = 0 |
|
618 | 628 | self.counter_imagwr = 0 |
|
619 | 629 | |
|
620 | 630 | self.PLOT_CODE = COH_CODE |
|
621 | 631 | |
|
622 | 632 | self.FTP_WEI = None |
|
623 | 633 | self.EXP_CODE = None |
|
624 | 634 | self.SUB_EXP_CODE = None |
|
625 | 635 | self.PLOT_POS = None |
|
626 | 636 | self.counter_imagwr = 0 |
|
627 | 637 | |
|
628 | 638 | self.xmin = None |
|
629 | 639 | self.xmax = None |
|
630 | 640 | |
|
631 | 641 | def getSubplots(self): |
|
632 | 642 | ncol = 1 |
|
633 | 643 | nrow = self.nplots*2 |
|
634 | 644 | |
|
635 | 645 | return nrow, ncol |
|
636 | 646 | |
|
637 | 647 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
638 | 648 | self.__showprofile = showprofile |
|
639 | 649 | self.nplots = nplots |
|
640 | 650 | |
|
641 | 651 | ncolspan = 1 |
|
642 | 652 | colspan = 1 |
|
643 | 653 | if showprofile: |
|
644 | 654 | ncolspan = 7 |
|
645 | 655 | colspan = 6 |
|
646 | 656 | self.__nsubplots = 2 |
|
647 | 657 | |
|
648 | 658 | self.createFigure(id = id, |
|
649 | 659 | wintitle = wintitle, |
|
650 | 660 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
651 | 661 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
652 | 662 | show=True) |
|
653 | 663 | |
|
654 | 664 | nrow, ncol = self.getSubplots() |
|
655 | 665 | |
|
656 | 666 | for y in range(nrow): |
|
657 | 667 | for x in range(ncol): |
|
658 | 668 | |
|
659 | 669 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
660 | 670 | |
|
661 | 671 | if showprofile: |
|
662 | 672 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
663 | 673 | |
|
664 | 674 | def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True', |
|
665 | 675 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
666 | 676 | timerange=None, |
|
667 | 677 | save=False, figpath='./', figfile=None, ftp=False, wr_period=1, |
|
668 | 678 | coherence_cmap='jet', phase_cmap='RdBu_r', show=True, |
|
669 | 679 | server=None, folder=None, username=None, password=None, |
|
670 | 680 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
671 | 681 | |
|
672 | 682 | if pairsList == None: |
|
673 | 683 | pairsIndexList = dataOut.pairsIndexList |
|
674 | 684 | else: |
|
675 | 685 | pairsIndexList = [] |
|
676 | 686 | for pair in pairsList: |
|
677 | 687 | if pair not in dataOut.pairsList: |
|
678 | 688 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
679 | 689 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
680 | 690 | |
|
681 | 691 | if pairsIndexList == []: |
|
682 | 692 | return |
|
683 | 693 | |
|
684 | 694 | if len(pairsIndexList) > 4: |
|
685 | 695 | pairsIndexList = pairsIndexList[0:4] |
|
686 | 696 | |
|
687 | 697 | # tmin = None |
|
688 | 698 | # tmax = None |
|
689 | 699 | x = dataOut.getTimeRange() |
|
690 | 700 | y = dataOut.getHeiRange() |
|
691 | 701 | |
|
692 | 702 | #thisDatetime = dataOut.datatime |
|
693 | 703 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
694 | 704 | title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
695 | 705 | xlabel = "" |
|
696 | 706 | ylabel = "Range (Km)" |
|
697 | 707 | |
|
698 | 708 | if not self.isConfig: |
|
699 | 709 | nplots = len(pairsIndexList) |
|
700 | 710 | self.setup(id=id, |
|
701 | 711 | nplots=nplots, |
|
702 | 712 | wintitle=wintitle, |
|
703 | 713 | showprofile=showprofile, |
|
704 | 714 | show=show) |
|
705 | 715 | |
|
706 | 716 | if timerange != None: |
|
707 | 717 | self.timerange = timerange |
|
708 | 718 | |
|
709 | 719 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
710 | 720 | |
|
711 | 721 | if ymin == None: ymin = numpy.nanmin(y) |
|
712 | 722 | if ymax == None: ymax = numpy.nanmax(y) |
|
713 | 723 | if zmin == None: zmin = 0. |
|
714 | 724 | if zmax == None: zmax = 1. |
|
715 | 725 | |
|
716 | 726 | self.FTP_WEI = ftp_wei |
|
717 | 727 | self.EXP_CODE = exp_code |
|
718 | 728 | self.SUB_EXP_CODE = sub_exp_code |
|
719 | 729 | self.PLOT_POS = plot_pos |
|
720 | 730 | |
|
721 | 731 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
722 | 732 | |
|
723 | 733 | self.isConfig = True |
|
724 | 734 | |
|
725 | 735 | self.setWinTitle(title) |
|
726 | 736 | |
|
727 | 737 | if ((self.xmax - x[1]) < (x[1]-x[0])): |
|
728 | 738 | x[1] = self.xmax |
|
729 | 739 | |
|
730 | 740 | for i in range(self.nplots): |
|
731 | 741 | |
|
732 | 742 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
733 | 743 | |
|
734 | 744 | ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0) |
|
735 | 745 | powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0) |
|
736 | 746 | powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0) |
|
737 | 747 | |
|
738 | 748 | |
|
739 | 749 | avgcoherenceComplex = ccf/numpy.sqrt(powa*powb) |
|
740 | 750 | coherence = numpy.abs(avgcoherenceComplex) |
|
741 | 751 | |
|
742 | 752 | z = coherence.reshape((1,-1)) |
|
743 | 753 | |
|
744 | 754 | counter = 0 |
|
745 | 755 | |
|
746 | 756 | title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
747 | 757 | axes = self.axesList[i*self.__nsubplots*2] |
|
748 | 758 | axes.pcolorbuffer(x, y, z, |
|
749 | 759 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
750 | 760 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
751 | 761 | ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%") |
|
752 | 762 | |
|
753 | 763 | if self.__showprofile: |
|
754 | 764 | counter += 1 |
|
755 | 765 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
756 | 766 | axes.pline(coherence, y, |
|
757 | 767 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
758 | 768 | xlabel='', ylabel='', title='', ticksize=7, |
|
759 | 769 | ytick_visible=False, nxticks=5, |
|
760 | 770 | grid='x') |
|
761 | 771 | |
|
762 | 772 | counter += 1 |
|
763 | 773 | |
|
764 | 774 | phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi |
|
765 | 775 | |
|
766 | 776 | z = phase.reshape((1,-1)) |
|
767 | 777 | |
|
768 | 778 | title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
769 | 779 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
770 | 780 | axes.pcolorbuffer(x, y, z, |
|
771 | 781 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180, |
|
772 | 782 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
773 | 783 | ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%") |
|
774 | 784 | |
|
775 | 785 | if self.__showprofile: |
|
776 | 786 | counter += 1 |
|
777 | 787 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
778 | 788 | axes.pline(phase, y, |
|
779 | 789 | xmin=-180, xmax=180, ymin=ymin, ymax=ymax, |
|
780 | 790 | xlabel='', ylabel='', title='', ticksize=7, |
|
781 | 791 | ytick_visible=False, nxticks=4, |
|
782 | 792 | grid='x') |
|
783 | 793 | |
|
784 | 794 | self.draw() |
|
785 | 795 | |
|
786 | 796 | if x[1] >= self.axesList[0].xmax: |
|
787 | 797 | self.counter_imagwr = wr_period |
|
788 | 798 | self.__isConfig = False |
|
789 | 799 | self.figfile = None |
|
790 | 800 | |
|
791 | 801 | self.save(figpath=figpath, |
|
792 | 802 | figfile=figfile, |
|
793 | 803 | save=save, |
|
794 | 804 | ftp=ftp, |
|
795 | 805 | wr_period=wr_period, |
|
796 | 806 | thisDatetime=thisDatetime, |
|
797 | 807 | update_figfile=False) |
|
798 | 808 | |
|
799 | 809 | class PowerProfilePlot(Figure): |
|
800 | 810 | |
|
801 | 811 | isConfig = None |
|
802 | 812 | __nsubplots = None |
|
803 | 813 | |
|
804 | 814 | WIDTHPROF = None |
|
805 | 815 | HEIGHTPROF = None |
|
806 | 816 | PREFIX = 'spcprofile' |
|
807 | 817 | |
|
808 | 818 | def __init__(self): |
|
809 | 819 | self.isConfig = False |
|
810 | 820 | self.__nsubplots = 1 |
|
811 | 821 | |
|
812 | 822 | self.PLOT_CODE = POWER_CODE |
|
813 | 823 | |
|
814 | 824 | self.WIDTH = 300 |
|
815 | 825 | self.HEIGHT = 500 |
|
816 | 826 | self.counter_imagwr = 0 |
|
817 | 827 | |
|
818 | 828 | def getSubplots(self): |
|
819 | 829 | ncol = 1 |
|
820 | 830 | nrow = 1 |
|
821 | 831 | |
|
822 | 832 | return nrow, ncol |
|
823 | 833 | |
|
824 | 834 | def setup(self, id, nplots, wintitle, show): |
|
825 | 835 | |
|
826 | 836 | self.nplots = nplots |
|
827 | 837 | |
|
828 | 838 | ncolspan = 1 |
|
829 | 839 | colspan = 1 |
|
830 | 840 | |
|
831 | 841 | self.createFigure(id = id, |
|
832 | 842 | wintitle = wintitle, |
|
833 | 843 | widthplot = self.WIDTH, |
|
834 | 844 | heightplot = self.HEIGHT, |
|
835 | 845 | show=show) |
|
836 | 846 | |
|
837 | 847 | nrow, ncol = self.getSubplots() |
|
838 | 848 | |
|
839 | 849 | counter = 0 |
|
840 | 850 | for y in range(nrow): |
|
841 | 851 | for x in range(ncol): |
|
842 | 852 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
843 | 853 | |
|
844 | 854 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
845 | 855 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
846 | 856 | save=False, figpath='./', figfile=None, show=True, |
|
847 | 857 | ftp=False, wr_period=1, server=None, |
|
848 | 858 | folder=None, username=None, password=None): |
|
849 | 859 | |
|
850 | 860 | |
|
851 | 861 | if channelList == None: |
|
852 | 862 | channelIndexList = dataOut.channelIndexList |
|
853 | 863 | channelList = dataOut.channelList |
|
854 | 864 | else: |
|
855 | 865 | channelIndexList = [] |
|
856 | 866 | for channel in channelList: |
|
857 | 867 | if channel not in dataOut.channelList: |
|
858 | 868 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
859 | 869 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
860 | 870 | |
|
861 | 871 | factor = dataOut.normFactor |
|
862 | 872 | |
|
863 | 873 | y = dataOut.getHeiRange() |
|
864 | 874 | |
|
865 | 875 | #for voltage |
|
866 | 876 | if dataOut.type == 'Voltage': |
|
867 | 877 | x = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:]) |
|
868 | 878 | x = x.real |
|
869 | 879 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
870 | 880 | |
|
871 | 881 | #for spectra |
|
872 | 882 | if dataOut.type == 'Spectra': |
|
873 | 883 | x = dataOut.data_spc[channelIndexList,:,:]/factor |
|
874 | 884 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
875 | 885 | x = numpy.average(x, axis=1) |
|
876 | 886 | |
|
877 | 887 | |
|
878 | 888 | xdB = 10*numpy.log10(x) |
|
879 | 889 | |
|
880 | 890 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
881 | 891 | title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
882 | 892 | xlabel = "dB" |
|
883 | 893 | ylabel = "Range (Km)" |
|
884 | 894 | |
|
885 | 895 | if not self.isConfig: |
|
886 | 896 | |
|
887 | 897 | nplots = 1 |
|
888 | 898 | |
|
889 | 899 | self.setup(id=id, |
|
890 | 900 | nplots=nplots, |
|
891 | 901 | wintitle=wintitle, |
|
892 | 902 | show=show) |
|
893 | 903 | |
|
894 | 904 | if ymin == None: ymin = numpy.nanmin(y) |
|
895 | 905 | if ymax == None: ymax = numpy.nanmax(y) |
|
896 | 906 | if xmin == None: xmin = numpy.nanmin(xdB)*0.9 |
|
897 | 907 | if xmax == None: xmax = numpy.nanmax(xdB)*1.1 |
|
898 | 908 | |
|
899 | 909 | self.__isConfig = True |
|
900 | 910 | |
|
901 | 911 | self.setWinTitle(title) |
|
902 | 912 | |
|
903 | 913 | title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
904 | 914 | axes = self.axesList[0] |
|
905 | 915 | |
|
906 | 916 | legendlabels = ["channel %d"%x for x in channelList] |
|
907 | 917 | axes.pmultiline(xdB, y, |
|
908 | 918 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
909 | 919 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, |
|
910 | 920 | ytick_visible=True, nxticks=5, |
|
911 | 921 | grid='x') |
|
912 | 922 | |
|
913 | 923 | self.draw() |
|
914 | 924 | |
|
915 | 925 | self.save(figpath=figpath, |
|
916 | 926 | figfile=figfile, |
|
917 | 927 | save=save, |
|
918 | 928 | ftp=ftp, |
|
919 | 929 | wr_period=wr_period, |
|
920 | 930 | thisDatetime=thisDatetime) |
|
921 | 931 | |
|
922 | 932 | class Noise(Figure): |
|
923 | 933 | |
|
924 | 934 | isConfig = None |
|
925 | 935 | __nsubplots = None |
|
926 | 936 | |
|
927 | 937 | PREFIX = 'noise' |
|
928 | 938 | |
|
929 | 939 | def __init__(self): |
|
930 | 940 | |
|
931 | 941 | self.timerange = 24*60*60 |
|
932 | 942 | self.isConfig = False |
|
933 | 943 | self.__nsubplots = 1 |
|
934 | 944 | self.counter_imagwr = 0 |
|
935 | 945 | self.WIDTH = 600 |
|
936 | 946 | self.HEIGHT = 300 |
|
937 | 947 | self.WIDTHPROF = 120 |
|
938 | 948 | self.HEIGHTPROF = 0 |
|
939 | 949 | self.xdata = None |
|
940 | 950 | self.ydata = None |
|
941 | 951 | |
|
942 | 952 | self.PLOT_CODE = NOISE_CODE |
|
943 | 953 | |
|
944 | 954 | self.FTP_WEI = None |
|
945 | 955 | self.EXP_CODE = None |
|
946 | 956 | self.SUB_EXP_CODE = None |
|
947 | 957 | self.PLOT_POS = None |
|
948 | 958 | self.figfile = None |
|
949 | 959 | |
|
950 | 960 | self.xmin = None |
|
951 | 961 | self.xmax = None |
|
952 | 962 | |
|
953 | 963 | def getSubplots(self): |
|
954 | 964 | |
|
955 | 965 | ncol = 1 |
|
956 | 966 | nrow = 1 |
|
957 | 967 | |
|
958 | 968 | return nrow, ncol |
|
959 | 969 | |
|
960 | 970 | def openfile(self, filename): |
|
961 | 971 | dirname = os.path.dirname(filename) |
|
962 | 972 | |
|
963 | 973 | if not os.path.exists(dirname): |
|
964 | 974 | os.mkdir(dirname) |
|
965 | 975 | |
|
966 | 976 | f = open(filename,'w+') |
|
967 | 977 | f.write('\n\n') |
|
968 | 978 | f.write('JICAMARCA RADIO OBSERVATORY - Noise \n') |
|
969 | 979 | f.write('DD MM YYYY HH MM SS Channel0 Channel1 Channel2 Channel3\n\n' ) |
|
970 | 980 | f.close() |
|
971 | 981 | |
|
972 | 982 | def save_data(self, filename_phase, data, data_datetime): |
|
973 | 983 | f=open(filename_phase,'a') |
|
974 | 984 | timetuple_data = data_datetime.timetuple() |
|
975 | 985 | day = str(timetuple_data.tm_mday) |
|
976 | 986 | month = str(timetuple_data.tm_mon) |
|
977 | 987 | year = str(timetuple_data.tm_year) |
|
978 | 988 | hour = str(timetuple_data.tm_hour) |
|
979 | 989 | minute = str(timetuple_data.tm_min) |
|
980 | 990 | second = str(timetuple_data.tm_sec) |
|
981 | 991 | |
|
982 | 992 | data_msg = '' |
|
983 | 993 | for i in range(len(data)): |
|
984 | 994 | data_msg += str(data[i]) + ' ' |
|
985 | 995 | |
|
986 | 996 | f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' ' + data_msg + '\n') |
|
987 | 997 | f.close() |
|
988 | 998 | |
|
989 | 999 | |
|
990 | 1000 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
991 | 1001 | |
|
992 | 1002 | self.__showprofile = showprofile |
|
993 | 1003 | self.nplots = nplots |
|
994 | 1004 | |
|
995 | 1005 | ncolspan = 7 |
|
996 | 1006 | colspan = 6 |
|
997 | 1007 | self.__nsubplots = 2 |
|
998 | 1008 | |
|
999 | 1009 | self.createFigure(id = id, |
|
1000 | 1010 | wintitle = wintitle, |
|
1001 | 1011 | widthplot = self.WIDTH+self.WIDTHPROF, |
|
1002 | 1012 | heightplot = self.HEIGHT+self.HEIGHTPROF, |
|
1003 | 1013 | show=show) |
|
1004 | 1014 | |
|
1005 | 1015 | nrow, ncol = self.getSubplots() |
|
1006 | 1016 | |
|
1007 | 1017 | self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1) |
|
1008 | 1018 | |
|
1009 | 1019 | |
|
1010 | 1020 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True', |
|
1011 | 1021 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1012 | 1022 | timerange=None, |
|
1013 | 1023 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1014 | 1024 | server=None, folder=None, username=None, password=None, |
|
1015 | 1025 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1016 | 1026 | |
|
1017 | 1027 | if channelList == None: |
|
1018 | 1028 | channelIndexList = dataOut.channelIndexList |
|
1019 | 1029 | channelList = dataOut.channelList |
|
1020 | 1030 | else: |
|
1021 | 1031 | channelIndexList = [] |
|
1022 | 1032 | for channel in channelList: |
|
1023 | 1033 | if channel not in dataOut.channelList: |
|
1024 | 1034 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
1025 | 1035 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
1026 | 1036 | |
|
1027 | 1037 | x = dataOut.getTimeRange() |
|
1028 | 1038 | #y = dataOut.getHeiRange() |
|
1029 | 1039 | factor = dataOut.normFactor |
|
1030 | 1040 | noise = dataOut.noise/factor |
|
1031 | 1041 | noisedB = 10*numpy.log10(noise) |
|
1032 | 1042 | |
|
1033 | 1043 | #thisDatetime = dataOut.datatime |
|
1034 | 1044 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
1035 | 1045 | title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1036 | 1046 | xlabel = "" |
|
1037 | 1047 | ylabel = "Intensity (dB)" |
|
1038 | 1048 | |
|
1039 | 1049 | if not self.isConfig: |
|
1040 | 1050 | |
|
1041 | 1051 | nplots = 1 |
|
1042 | 1052 | |
|
1043 | 1053 | self.setup(id=id, |
|
1044 | 1054 | nplots=nplots, |
|
1045 | 1055 | wintitle=wintitle, |
|
1046 | 1056 | showprofile=showprofile, |
|
1047 | 1057 | show=show) |
|
1048 | 1058 | |
|
1049 | 1059 | if timerange != None: |
|
1050 | 1060 | self.timerange = timerange |
|
1051 | 1061 | |
|
1052 | 1062 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1053 | 1063 | |
|
1054 | 1064 | if ymin == None: ymin = numpy.floor(numpy.nanmin(noisedB)) - 10.0 |
|
1055 | 1065 | if ymax == None: ymax = numpy.nanmax(noisedB) + 10.0 |
|
1056 | 1066 | |
|
1057 | 1067 | self.FTP_WEI = ftp_wei |
|
1058 | 1068 | self.EXP_CODE = exp_code |
|
1059 | 1069 | self.SUB_EXP_CODE = sub_exp_code |
|
1060 | 1070 | self.PLOT_POS = plot_pos |
|
1061 | 1071 | |
|
1062 | 1072 | |
|
1063 | 1073 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1064 | 1074 | self.isConfig = True |
|
1065 | 1075 | self.figfile = figfile |
|
1066 | 1076 | self.xdata = numpy.array([]) |
|
1067 | 1077 | self.ydata = numpy.array([]) |
|
1068 | 1078 | |
|
1069 | 1079 | #open file beacon phase |
|
1070 | 1080 | path = '%s%03d' %(self.PREFIX, self.id) |
|
1071 | 1081 | noise_file = os.path.join(path,'%s.txt'%self.name) |
|
1072 | 1082 | self.filename_noise = os.path.join(figpath,noise_file) |
|
1073 | 1083 | if save: |
|
1074 | 1084 | self.openfile(self.filename_noise) |
|
1075 | 1085 | |
|
1076 | 1086 | |
|
1077 | 1087 | #store data beacon phase |
|
1078 | 1088 | if save: |
|
1079 | 1089 | self.save_data(self.filename_noise, noisedB, thisDatetime) |
|
1080 | 1090 | |
|
1081 | 1091 | |
|
1082 | 1092 | self.setWinTitle(title) |
|
1083 | 1093 | |
|
1084 | 1094 | |
|
1085 | 1095 | title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1086 | 1096 | |
|
1087 | 1097 | legendlabels = ["channel %d"%(idchannel+1) for idchannel in channelList] |
|
1088 | 1098 | axes = self.axesList[0] |
|
1089 | 1099 | |
|
1090 | 1100 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
|
1091 | 1101 | |
|
1092 | 1102 | if len(self.ydata)==0: |
|
1093 | 1103 | self.ydata = noisedB[channelIndexList].reshape(-1,1) |
|
1094 | 1104 | else: |
|
1095 | 1105 | self.ydata = numpy.hstack((self.ydata, noisedB[channelIndexList].reshape(-1,1))) |
|
1096 | 1106 | |
|
1097 | 1107 | |
|
1098 | 1108 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1099 | 1109 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, |
|
1100 | 1110 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1101 | 1111 | XAxisAsTime=True, grid='both' |
|
1102 | 1112 | ) |
|
1103 | 1113 | |
|
1104 | 1114 | self.draw() |
|
1105 | 1115 | |
|
1106 | 1116 | if x[1] >= self.axesList[0].xmax: |
|
1107 | 1117 | self.counter_imagwr = wr_period |
|
1108 | 1118 | del self.xdata |
|
1109 | 1119 | del self.ydata |
|
1110 | 1120 | self.__isConfig = False |
|
1111 | 1121 | self.figfile = None |
|
1112 | 1122 | |
|
1113 | 1123 | self.save(figpath=figpath, |
|
1114 | 1124 | figfile=figfile, |
|
1115 | 1125 | save=save, |
|
1116 | 1126 | ftp=ftp, |
|
1117 | 1127 | wr_period=wr_period, |
|
1118 | 1128 | thisDatetime=thisDatetime, |
|
1119 | 1129 | update_figfile=False) |
|
1120 | 1130 | |
|
1121 | 1131 | |
|
1122 | 1132 | class BeaconPhase(Figure): |
|
1123 | 1133 | |
|
1124 | 1134 | __isConfig = None |
|
1125 | 1135 | __nsubplots = None |
|
1126 | 1136 | |
|
1127 | 1137 | PREFIX = 'beacon_phase' |
|
1128 | 1138 | |
|
1129 | 1139 | def __init__(self): |
|
1130 | 1140 | |
|
1131 | 1141 | self.timerange = 24*60*60 |
|
1132 | 1142 | self.__isConfig = False |
|
1133 | 1143 | self.__nsubplots = 1 |
|
1134 | 1144 | self.counter_imagwr = 0 |
|
1135 | 1145 | self.WIDTH = 600 |
|
1136 | 1146 | self.HEIGHT = 300 |
|
1137 | 1147 | self.WIDTHPROF = 120 |
|
1138 | 1148 | self.HEIGHTPROF = 0 |
|
1139 | 1149 | self.xdata = None |
|
1140 | 1150 | self.ydata = None |
|
1141 | 1151 | |
|
1142 | 1152 | self.PLOT_CODE = BEACON_CODE |
|
1143 | 1153 | |
|
1144 | 1154 | self.FTP_WEI = None |
|
1145 | 1155 | self.EXP_CODE = None |
|
1146 | 1156 | self.SUB_EXP_CODE = None |
|
1147 | 1157 | self.PLOT_POS = None |
|
1148 | 1158 | |
|
1149 | 1159 | self.filename_phase = None |
|
1150 | 1160 | |
|
1151 | 1161 | self.figfile = None |
|
1152 | 1162 | |
|
1153 | 1163 | self.xmin = None |
|
1154 | 1164 | self.xmax = None |
|
1155 | 1165 | |
|
1156 | 1166 | def getSubplots(self): |
|
1157 | 1167 | |
|
1158 | 1168 | ncol = 1 |
|
1159 | 1169 | nrow = 1 |
|
1160 | 1170 | |
|
1161 | 1171 | return nrow, ncol |
|
1162 | 1172 | |
|
1163 | 1173 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1164 | 1174 | |
|
1165 | 1175 | self.__showprofile = showprofile |
|
1166 | 1176 | self.nplots = nplots |
|
1167 | 1177 | |
|
1168 | 1178 | ncolspan = 7 |
|
1169 | 1179 | colspan = 6 |
|
1170 | 1180 | self.__nsubplots = 2 |
|
1171 | 1181 | |
|
1172 | 1182 | self.createFigure(id = id, |
|
1173 | 1183 | wintitle = wintitle, |
|
1174 | 1184 | widthplot = self.WIDTH+self.WIDTHPROF, |
|
1175 | 1185 | heightplot = self.HEIGHT+self.HEIGHTPROF, |
|
1176 | 1186 | show=show) |
|
1177 | 1187 | |
|
1178 | 1188 | nrow, ncol = self.getSubplots() |
|
1179 | 1189 | |
|
1180 | 1190 | self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1) |
|
1181 | 1191 | |
|
1182 | 1192 | def save_phase(self, filename_phase): |
|
1183 | 1193 | f = open(filename_phase,'w+') |
|
1184 | 1194 | f.write('\n\n') |
|
1185 | 1195 | f.write('JICAMARCA RADIO OBSERVATORY - Beacon Phase \n') |
|
1186 | 1196 | f.write('DD MM YYYY HH MM SS pair(2,0) pair(2,1) pair(2,3) pair(2,4)\n\n' ) |
|
1187 | 1197 | f.close() |
|
1188 | 1198 | |
|
1189 | 1199 | def save_data(self, filename_phase, data, data_datetime): |
|
1190 | 1200 | f=open(filename_phase,'a') |
|
1191 | 1201 | timetuple_data = data_datetime.timetuple() |
|
1192 | 1202 | day = str(timetuple_data.tm_mday) |
|
1193 | 1203 | month = str(timetuple_data.tm_mon) |
|
1194 | 1204 | year = str(timetuple_data.tm_year) |
|
1195 | 1205 | hour = str(timetuple_data.tm_hour) |
|
1196 | 1206 | minute = str(timetuple_data.tm_min) |
|
1197 | 1207 | second = str(timetuple_data.tm_sec) |
|
1198 | 1208 | f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' '+str(data[0])+' '+str(data[1])+' '+str(data[2])+' '+str(data[3])+'\n') |
|
1199 | 1209 | f.close() |
|
1200 | 1210 | |
|
1201 | 1211 | |
|
1202 | 1212 | def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True', |
|
1203 | 1213 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1204 | 1214 | timerange=None, |
|
1205 | 1215 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1206 | 1216 | server=None, folder=None, username=None, password=None, |
|
1207 | 1217 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1208 | 1218 | |
|
1209 | 1219 | if pairsList == None: |
|
1210 | 1220 | pairsIndexList = dataOut.pairsIndexList |
|
1211 | 1221 | else: |
|
1212 | 1222 | pairsIndexList = [] |
|
1213 | 1223 | for pair in pairsList: |
|
1214 | 1224 | if pair not in dataOut.pairsList: |
|
1215 | 1225 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
1216 | 1226 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
1217 | 1227 | |
|
1218 | 1228 | if pairsIndexList == []: |
|
1219 | 1229 | return |
|
1220 | 1230 | |
|
1221 | 1231 | # if len(pairsIndexList) > 4: |
|
1222 | 1232 | # pairsIndexList = pairsIndexList[0:4] |
|
1223 | 1233 | |
|
1224 | 1234 | x = dataOut.getTimeRange() |
|
1225 | 1235 | #y = dataOut.getHeiRange() |
|
1226 | 1236 | |
|
1227 | 1237 | |
|
1228 | 1238 | #thisDatetime = dataOut.datatime |
|
1229 | 1239 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
1230 | 1240 | title = wintitle + " Phase of Beacon Signal" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1231 | 1241 | xlabel = "Local Time" |
|
1232 | 1242 | ylabel = "Phase" |
|
1233 | 1243 | |
|
1234 | 1244 | nplots = len(pairsIndexList) |
|
1235 | 1245 | #phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList))) |
|
1236 | 1246 | phase_beacon = numpy.zeros(len(pairsIndexList)) |
|
1237 | 1247 | for i in range(nplots): |
|
1238 | 1248 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
1239 | 1249 | ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0) |
|
1240 | 1250 | powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0) |
|
1241 | 1251 | powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0) |
|
1242 | 1252 | avgcoherenceComplex = ccf/numpy.sqrt(powa*powb) |
|
1243 | 1253 | phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi |
|
1244 | 1254 | |
|
1245 | 1255 | #print "Phase %d%d" %(pair[0], pair[1]) |
|
1246 | 1256 | #print phase[dataOut.beacon_heiIndexList] |
|
1247 | 1257 | |
|
1248 | 1258 | phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList]) |
|
1249 | 1259 | |
|
1250 | 1260 | if not self.__isConfig: |
|
1251 | 1261 | |
|
1252 | 1262 | nplots = len(pairsIndexList) |
|
1253 | 1263 | |
|
1254 | 1264 | self.setup(id=id, |
|
1255 | 1265 | nplots=nplots, |
|
1256 | 1266 | wintitle=wintitle, |
|
1257 | 1267 | showprofile=showprofile, |
|
1258 | 1268 | show=show) |
|
1259 | 1269 | |
|
1260 | 1270 | if timerange != None: |
|
1261 | 1271 | self.timerange = timerange |
|
1262 | 1272 | |
|
1263 | 1273 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1264 | 1274 | |
|
1265 | 1275 | if ymin == None: ymin = numpy.nanmin(phase_beacon) - 10.0 |
|
1266 | 1276 | if ymax == None: ymax = numpy.nanmax(phase_beacon) + 10.0 |
|
1267 | 1277 | |
|
1268 | 1278 | self.FTP_WEI = ftp_wei |
|
1269 | 1279 | self.EXP_CODE = exp_code |
|
1270 | 1280 | self.SUB_EXP_CODE = sub_exp_code |
|
1271 | 1281 | self.PLOT_POS = plot_pos |
|
1272 | 1282 | |
|
1273 | 1283 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1274 | 1284 | self.__isConfig = True |
|
1275 | 1285 | self.figfile = figfile |
|
1276 | 1286 | self.xdata = numpy.array([]) |
|
1277 | 1287 | self.ydata = numpy.array([]) |
|
1278 | 1288 | |
|
1279 | 1289 | #open file beacon phase |
|
1280 | 1290 | path = '%s%03d' %(self.PREFIX, self.id) |
|
1281 | 1291 | beacon_file = os.path.join(path,'%s.txt'%self.name) |
|
1282 | 1292 | self.filename_phase = os.path.join(figpath,beacon_file) |
|
1283 | 1293 | #self.save_phase(self.filename_phase) |
|
1284 | 1294 | |
|
1285 | 1295 | |
|
1286 | 1296 | #store data beacon phase |
|
1287 | 1297 | #self.save_data(self.filename_phase, phase_beacon, thisDatetime) |
|
1288 | 1298 | |
|
1289 | 1299 | self.setWinTitle(title) |
|
1290 | 1300 | |
|
1291 | 1301 | |
|
1292 | 1302 | title = "Beacon Signal %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1293 | 1303 | |
|
1294 | 1304 | legendlabels = ["pairs %d%d"%(pair[0], pair[1]) for pair in dataOut.pairsList] |
|
1295 | 1305 | |
|
1296 | 1306 | axes = self.axesList[0] |
|
1297 | 1307 | |
|
1298 | 1308 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
|
1299 | 1309 | |
|
1300 | 1310 | if len(self.ydata)==0: |
|
1301 | 1311 | self.ydata = phase_beacon.reshape(-1,1) |
|
1302 | 1312 | else: |
|
1303 | 1313 | self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1))) |
|
1304 | 1314 | |
|
1305 | 1315 | |
|
1306 | 1316 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1307 | 1317 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, |
|
1308 | 1318 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1309 | 1319 | XAxisAsTime=True, grid='both' |
|
1310 | 1320 | ) |
|
1311 | 1321 | |
|
1312 | 1322 | self.draw() |
|
1313 | 1323 | |
|
1314 | 1324 | if x[1] >= self.axesList[0].xmax: |
|
1315 | 1325 | self.counter_imagwr = wr_period |
|
1316 | 1326 | del self.xdata |
|
1317 | 1327 | del self.ydata |
|
1318 | 1328 | self.__isConfig = False |
|
1319 | 1329 | self.figfile = None |
|
1320 | 1330 | |
|
1321 | 1331 | self.save(figpath=figpath, |
|
1322 | 1332 | figfile=figfile, |
|
1323 | 1333 | save=save, |
|
1324 | 1334 | ftp=ftp, |
|
1325 | 1335 | wr_period=wr_period, |
|
1326 | 1336 | thisDatetime=thisDatetime, |
|
1327 | 1337 | update_figfile=False) |
@@ -1,580 +1,581 | |||
|
1 | 1 | ''' |
|
2 | 2 | Created on Jul 3, 2014 |
|
3 | 3 | |
|
4 | 4 | @author: roj-idl71 |
|
5 | 5 | ''' |
|
6 | 6 | import datetime |
|
7 | 7 | import numpy |
|
8 | 8 | |
|
9 | 9 | try: |
|
10 | 10 | from gevent import sleep |
|
11 | 11 | except: |
|
12 | 12 | from time import sleep |
|
13 | 13 | |
|
14 | 14 | from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader |
|
15 | 15 | from schainpy.model.data.jrodata import Voltage |
|
16 | 16 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
17 | 17 | |
|
18 | 18 | try: |
|
19 | 19 | import digital_rf_hdf5 |
|
20 | 20 | except: |
|
21 | 21 | print 'You should install "digital_rf_hdf5" module if you want to read USRP data' |
|
22 | 22 | |
|
23 | 23 | class USRPReader(ProcessingUnit): |
|
24 | 24 | ''' |
|
25 | 25 | classdocs |
|
26 | 26 | ''' |
|
27 | 27 | |
|
28 | 28 | def __init__(self): |
|
29 | 29 | ''' |
|
30 | 30 | Constructor |
|
31 | 31 | ''' |
|
32 | 32 | |
|
33 | 33 | ProcessingUnit.__init__(self) |
|
34 | 34 | |
|
35 | 35 | self.dataOut = Voltage() |
|
36 | 36 | self.__printInfo = True |
|
37 | 37 | self.__flagDiscontinuousBlock = False |
|
38 | 38 | self.__bufferIndex = 9999999 |
|
39 | 39 | |
|
40 | 40 | self.__ippKm = None |
|
41 | 41 | self.__codeType = 0 |
|
42 | 42 | self.__nCode = None |
|
43 | 43 | self.__nBaud = None |
|
44 | 44 | self.__code = None |
|
45 | 45 | |
|
46 | 46 | def __getCurrentSecond(self): |
|
47 | 47 | |
|
48 | 48 | return self.__thisUnixSample/self.__sample_rate |
|
49 | 49 | |
|
50 | 50 | thisSecond = property(__getCurrentSecond, "I'm the 'thisSecond' property.") |
|
51 | 51 | |
|
52 | 52 | def __setFileHeader(self): |
|
53 | 53 | ''' |
|
54 | 54 | In this method will be initialized every parameter of dataOut object (header, no data) |
|
55 | 55 | ''' |
|
56 | nProfiles = self.__sample_rate #Number of profiles by second | |
|
56 | 57 | |
|
57 | 58 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ippKm=self.__ippKm, |
|
58 | 59 | txA=0, |
|
59 | 60 | txB=0, |
|
60 | 61 | nWindows=1, |
|
61 | 62 | nHeights=self.__nSamples, |
|
62 | 63 | firstHeight=self.__firstHeigth, |
|
63 | 64 | deltaHeight=self.__deltaHeigth, |
|
64 | 65 | codeType=self.__codeType, |
|
65 | 66 | nCode=self.__nCode, nBaud=self.__nBaud, |
|
66 | 67 | code = self.__code) |
|
67 | 68 | |
|
68 | 69 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, |
|
69 |
nProfiles= |
|
|
70 | nProfiles=nProfiles, | |
|
70 | 71 | nChannels=len(self.__channelList), |
|
71 | 72 | adcResolution=14) |
|
72 | 73 | |
|
73 | 74 | self.dataOut.type = "Voltage" |
|
74 | 75 | |
|
75 | 76 | self.dataOut.data = None |
|
76 | 77 | |
|
77 | 78 | self.dataOut.dtype = numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
78 | 79 | |
|
79 | 80 | # self.dataOut.nChannels = 0 |
|
80 | 81 | |
|
81 | 82 | # self.dataOut.nHeights = 0 |
|
82 | 83 | |
|
83 |
self.dataOut.nProfiles = |
|
|
84 | self.dataOut.nProfiles = nProfiles | |
|
84 | 85 | |
|
85 | 86 | self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype = numpy.float)*self.__deltaHeigth |
|
86 | 87 | |
|
87 | 88 | self.dataOut.channelList = self.__channelList |
|
88 | 89 | |
|
89 | 90 | self.dataOut.blocksize = self.dataOut.getNChannels() * self.dataOut.getNHeights() |
|
90 | 91 | |
|
91 | 92 | # self.dataOut.channelIndexList = None |
|
92 | 93 | |
|
93 | 94 | self.dataOut.flagNoData = True |
|
94 | 95 | |
|
95 | 96 | #Set to TRUE if the data is discontinuous |
|
96 | 97 | self.dataOut.flagDiscontinuousBlock = False |
|
97 | 98 | |
|
98 | 99 | self.dataOut.utctime = None |
|
99 | 100 | |
|
100 | 101 | self.dataOut.timeZone = self.__timezone/60 #timezone like jroheader, difference in minutes between UTC and localtime |
|
101 | 102 | |
|
102 | 103 | self.dataOut.dstFlag = 0 |
|
103 | 104 | |
|
104 | 105 | self.dataOut.errorCount = 0 |
|
105 | 106 | |
|
106 | 107 | self.dataOut.nCohInt = 1 |
|
107 | 108 | |
|
108 | 109 | self.dataOut.flagDecodeData = False #asumo que la data esta decodificada |
|
109 | 110 | |
|
110 | 111 | self.dataOut.flagDeflipData = False #asumo que la data esta sin flip |
|
111 | 112 | |
|
112 | 113 | self.dataOut.flagShiftFFT = False |
|
113 | 114 | |
|
114 | 115 | self.dataOut.ippSeconds = 1.0*self.__nSamples/self.__sample_rate |
|
115 | 116 | |
|
116 | 117 | #Time interval between profiles |
|
117 | 118 | #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt |
|
118 | 119 | |
|
119 | 120 | self.dataOut.frequency = self.__frequency |
|
120 | 121 | |
|
121 | 122 | self.dataOut.realtime = self.__online |
|
122 | 123 | |
|
123 | 124 | def findDatafiles(self, path, startDate=None, endDate=None): |
|
124 | 125 | |
|
125 | 126 | try: |
|
126 | 127 | digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) |
|
127 | 128 | except: |
|
128 | 129 | digitalReadObj = digital_rf_hdf5.read_hdf5(path) |
|
129 | 130 | |
|
130 | 131 | channelNameList = digitalReadObj.get_channels() |
|
131 | 132 | |
|
132 | 133 | if not channelNameList: |
|
133 | 134 | return [] |
|
134 | 135 | |
|
135 | 136 | metadata_dict = digitalReadObj.get_rf_file_metadata(channelNameList[0]) |
|
136 | 137 | |
|
137 | 138 | sample_rate = metadata_dict['sample_rate'][0] |
|
138 | 139 | |
|
139 | 140 | this_metadata_file = digitalReadObj.get_metadata(channelNameList[0]) |
|
140 | 141 | |
|
141 | 142 | try: |
|
142 | 143 | timezone = this_metadata_file['timezone'].value |
|
143 | 144 | except: |
|
144 | 145 | timezone = 0 |
|
145 | 146 | |
|
146 | 147 | startUTCSecond, endUTCSecond = digitalReadObj.get_bounds(channelNameList[0])/sample_rate - timezone |
|
147 | 148 | |
|
148 | 149 | startDatetime = datetime.datetime.utcfromtimestamp(startUTCSecond) |
|
149 | 150 | endDatatime = datetime.datetime.utcfromtimestamp(endUTCSecond) |
|
150 | 151 | |
|
151 | 152 | if not startDate: |
|
152 | 153 | startDate = startDatetime.date() |
|
153 | 154 | |
|
154 | 155 | if not endDate: |
|
155 | 156 | endDate = endDatatime.date() |
|
156 | 157 | |
|
157 | 158 | dateList = [] |
|
158 | 159 | |
|
159 | 160 | thisDatetime = startDatetime |
|
160 | 161 | |
|
161 | 162 | while(thisDatetime<=endDatatime): |
|
162 | 163 | |
|
163 | 164 | thisDate = thisDatetime.date() |
|
164 | 165 | |
|
165 | 166 | if thisDate < startDate: |
|
166 | 167 | continue |
|
167 | 168 | |
|
168 | 169 | if thisDate > endDate: |
|
169 | 170 | break |
|
170 | 171 | |
|
171 | 172 | dateList.append(thisDate) |
|
172 | 173 | thisDatetime += datetime.timedelta(1) |
|
173 | 174 | |
|
174 | 175 | return dateList |
|
175 | 176 | |
|
176 | 177 | def setup(self, path = None, |
|
177 | 178 | startDate = None, |
|
178 | 179 | endDate = None, |
|
179 | 180 | startTime = datetime.time(0,0,0), |
|
180 | 181 | endTime = datetime.time(23,59,59), |
|
181 | 182 | channelList = None, |
|
182 | 183 | nSamples = None, |
|
183 | 184 | ippKm = 60, |
|
184 | 185 | online = False, |
|
185 | 186 | delay = 60, |
|
186 | 187 | buffer_size = None, |
|
187 | 188 | nbuffer = 1024, |
|
188 | 189 | **kwargs): |
|
189 | 190 | ''' |
|
190 | 191 | In this method we should set all initial parameters. |
|
191 | 192 | |
|
192 | 193 | Inputs: |
|
193 | 194 | path |
|
194 | 195 | startDate |
|
195 | 196 | endDate |
|
196 | 197 | startTime |
|
197 | 198 | endTime |
|
198 | 199 | set |
|
199 | 200 | expLabel |
|
200 | 201 | ext |
|
201 | 202 | online |
|
202 | 203 | delay |
|
203 | 204 | ''' |
|
204 | 205 | |
|
205 | 206 | if not buffer_size: |
|
206 | 207 | buffer_size = nbuffer |
|
207 | 208 | |
|
208 | 209 | try: |
|
209 | 210 | self.digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) |
|
210 | 211 | except: |
|
211 | 212 | self.digitalReadObj = digital_rf_hdf5.read_hdf5(path) |
|
212 | 213 | |
|
213 | 214 | channelNameList = self.digitalReadObj.get_channels() |
|
214 | 215 | |
|
215 | 216 | if not channelNameList: |
|
216 | 217 | raise IOError, "[Reading] The path doesn,t have any files .. " |
|
217 | 218 | |
|
218 | 219 | if not channelList: |
|
219 | 220 | channelList = range(len(channelNameList)) |
|
220 | 221 | |
|
221 | 222 | ########## Reading metadata ###################### |
|
222 | 223 | |
|
223 | 224 | metadata_dict = self.digitalReadObj.get_rf_file_metadata(channelNameList[channelList[0]]) |
|
224 | 225 | |
|
225 | 226 | self.__sample_rate = metadata_dict['sample_rate'][0] |
|
226 | 227 | self.__samples_per_file = metadata_dict['samples_per_file'][0] |
|
227 | 228 | self.__deltaHeigth = 1e6*0.15/self.__sample_rate |
|
228 | 229 | |
|
229 | 230 | this_metadata_file = self.digitalReadObj.get_metadata(channelNameList[channelList[0]]) |
|
230 | 231 | |
|
231 | 232 | self.__frequency = this_metadata_file['center_frequencies'].value |
|
232 | 233 | try: |
|
233 | 234 | self.__timezone = this_metadata_file['timezone'].value |
|
234 | 235 | except: |
|
235 | 236 | self.__timezone = 0 |
|
236 | 237 | |
|
237 | 238 | self.__firstHeigth = 0 |
|
238 | 239 | |
|
239 | 240 | try: |
|
240 | 241 | codeType = this_metadata_file['codeType'].value |
|
241 | 242 | except: |
|
242 | 243 | codeType = 0 |
|
243 | 244 | |
|
244 | 245 | nCode = 0 |
|
245 | 246 | nBaud = 0 |
|
246 | 247 | code = None |
|
247 | 248 | |
|
248 | 249 | if codeType: |
|
249 | 250 | nCode = this_metadata_file['nCode'].value |
|
250 | 251 | nBaud = this_metadata_file['nBaud'].value |
|
251 | 252 | code = this_metadata_file['code'].value |
|
252 | 253 | |
|
253 | 254 | if not ippKm: |
|
254 | 255 | try: |
|
255 | 256 | #seconds to km |
|
256 | 257 | ippKm = 1e6*0.15*this_metadata_file['ipp'].value |
|
257 | 258 | except: |
|
258 | 259 | ippKm = None |
|
259 | 260 | |
|
260 | 261 | #################################################### |
|
261 | 262 | startUTCSecond = None |
|
262 | 263 | endUTCSecond = None |
|
263 | 264 | |
|
264 | 265 | if startDate: |
|
265 | 266 | startDatetime = datetime.datetime.combine(startDate, startTime) |
|
266 | 267 | startUTCSecond = (startDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone |
|
267 | 268 | |
|
268 | 269 | if endDate: |
|
269 | 270 | endDatetime = datetime.datetime.combine(endDate, endTime) |
|
270 | 271 | endUTCSecond = (endDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone |
|
271 | 272 | |
|
272 | 273 | start_index, end_index = self.digitalReadObj.get_bounds(channelNameList[channelList[0]]) |
|
273 | 274 | |
|
274 | 275 | if not startUTCSecond: |
|
275 | 276 | startUTCSecond = start_index/self.__sample_rate |
|
276 | 277 | |
|
277 | 278 | if start_index > startUTCSecond*self.__sample_rate: |
|
278 | 279 | startUTCSecond = start_index/self.__sample_rate |
|
279 | 280 | |
|
280 | 281 | if not endUTCSecond: |
|
281 | 282 | endUTCSecond = end_index/self.__sample_rate |
|
282 | 283 | |
|
283 | 284 | if end_index < endUTCSecond*self.__sample_rate: |
|
284 | 285 | endUTCSecond = end_index/self.__sample_rate |
|
285 | 286 | |
|
286 | 287 | if not nSamples: |
|
287 | 288 | if not ippKm: |
|
288 | 289 | raise ValueError, "[Reading] nSamples or ippKm should be defined" |
|
289 | 290 | |
|
290 | 291 | nSamples = ippKm / (1e6*0.15/self.__sample_rate) |
|
291 | 292 | |
|
292 | 293 | channelBoundList = [] |
|
293 | 294 | channelNameListFiltered = [] |
|
294 | 295 | |
|
295 | 296 | for thisIndexChannel in channelList: |
|
296 | 297 | thisChannelName = channelNameList[thisIndexChannel] |
|
297 | 298 | start_index, end_index = self.digitalReadObj.get_bounds(thisChannelName) |
|
298 | 299 | channelBoundList.append((start_index, end_index)) |
|
299 | 300 | channelNameListFiltered.append(thisChannelName) |
|
300 | 301 | |
|
301 | 302 | self.profileIndex = 0 |
|
302 | 303 | |
|
303 | 304 | self.__delay = delay |
|
304 | 305 | self.__ippKm = ippKm |
|
305 | 306 | self.__codeType = codeType |
|
306 | 307 | self.__nCode = nCode |
|
307 | 308 | self.__nBaud = nBaud |
|
308 | 309 | self.__code = code |
|
309 | 310 | |
|
310 | 311 | self.__datapath = path |
|
311 | 312 | self.__online = online |
|
312 | 313 | self.__channelList = channelList |
|
313 | 314 | self.__channelNameList = channelNameListFiltered |
|
314 | 315 | self.__channelBoundList = channelBoundList |
|
315 | 316 | self.__nSamples = nSamples |
|
316 | 317 | self.__samples_to_read = buffer_size*nSamples |
|
317 | 318 | self.__nChannels = len(self.__channelList) |
|
318 | 319 | |
|
319 | 320 | self.__startUTCSecond = startUTCSecond |
|
320 | 321 | self.__endUTCSecond = endUTCSecond |
|
321 | 322 | |
|
322 | 323 | self.__timeInterval = 1.0 * self.__samples_to_read/self.__sample_rate #Time interval |
|
323 | 324 | |
|
324 | 325 | if online: |
|
325 | 326 | # self.__thisUnixSample = int(endUTCSecond*self.__sample_rate - 4*self.__samples_to_read) |
|
326 | 327 | startUTCSecond = numpy.floor(endUTCSecond) |
|
327 | 328 | |
|
328 | 329 | self.__thisUnixSample = int(startUTCSecond*self.__sample_rate) - self.__samples_to_read |
|
329 | 330 | |
|
330 | 331 | self.__data_buffer = numpy.zeros((self.__nChannels, self.__samples_to_read), dtype = numpy.complex) |
|
331 | 332 | |
|
332 | 333 | self.__setFileHeader() |
|
333 | 334 | self.isConfig = True |
|
334 | 335 | |
|
335 | 336 | print "[Reading] USRP Data was found from %s to %s " %( |
|
336 | 337 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
337 | 338 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
338 | 339 | ) |
|
339 | 340 | |
|
340 | 341 | print "[Reading] Starting process from ", datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), " to ", datetime.datetime.utcfromtimestamp(endUTCSecond - self.__timezone) |
|
341 | 342 | |
|
342 | 343 | def __reload(self): |
|
343 | 344 | |
|
344 | 345 | if not self.__online: |
|
345 | 346 | return |
|
346 | 347 | |
|
347 | 348 | |
|
348 | 349 | # print "%s not in range [%s, %s]" %( |
|
349 | 350 | # datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
350 | 351 | # datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
351 | 352 | # datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
352 | 353 | # ) |
|
353 | 354 | print "[Reading] reloading metadata ..." |
|
354 | 355 | |
|
355 | 356 | try: |
|
356 | 357 | self.digitalReadObj.reload(complete_update=True) |
|
357 | 358 | except: |
|
358 | 359 | self.digitalReadObj.reload() |
|
359 | 360 | |
|
360 | 361 | start_index, end_index = self.digitalReadObj.get_bounds(self.__channelNameList[self.__channelList[0]]) |
|
361 | 362 | |
|
362 | 363 | if start_index > self.__startUTCSecond*self.__sample_rate: |
|
363 | 364 | self.__startUTCSecond = 1.0*start_index/self.__sample_rate |
|
364 | 365 | |
|
365 | 366 | if end_index > self.__endUTCSecond*self.__sample_rate: |
|
366 | 367 | self.__endUTCSecond = 1.0*end_index/self.__sample_rate |
|
367 | 368 | |
|
368 | 369 | print "[Reading] New timerange found [%s, %s] " %( |
|
369 | 370 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
370 | 371 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
371 | 372 | ) |
|
372 | 373 | |
|
373 | 374 | return True |
|
374 | 375 | |
|
375 | 376 | return False |
|
376 | 377 | |
|
377 | 378 | def __readNextBlock(self, seconds=30, volt_scale = 218776): |
|
378 | 379 | ''' |
|
379 | 380 | ''' |
|
380 | 381 | |
|
381 | 382 | #Set the next data |
|
382 | 383 | self.__flagDiscontinuousBlock = False |
|
383 | 384 | self.__thisUnixSample += self.__samples_to_read |
|
384 | 385 | |
|
385 | 386 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: |
|
386 | 387 | print "[Reading] There are no more data into selected timerange" |
|
387 | 388 | |
|
388 | 389 | self.__reload() |
|
389 | 390 | |
|
390 | 391 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: |
|
391 | 392 | self.__thisUnixSample -= self.__samples_to_read |
|
392 | 393 | return False |
|
393 | 394 | |
|
394 | 395 | indexChannel = 0 |
|
395 | 396 | |
|
396 | 397 | dataOk = False |
|
397 | 398 | |
|
398 | 399 | for thisChannelName in self.__channelNameList: |
|
399 | 400 | |
|
400 | 401 | try: |
|
401 | 402 | result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample, |
|
402 | 403 | self.__samples_to_read, |
|
403 | 404 | thisChannelName) |
|
404 | 405 | |
|
405 | 406 | except IOError, e: |
|
406 | 407 | #read next profile |
|
407 | 408 | self.__flagDiscontinuousBlock = True |
|
408 | 409 | print e |
|
409 | 410 | break |
|
410 | 411 | |
|
411 | 412 | if result.shape[0] != self.__samples_to_read: |
|
412 | 413 | self.__flagDiscontinuousBlock = True |
|
413 | 414 | print "[Reading] %s: Too few samples were found, just %d samples" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
414 | 415 | result.shape[0]) |
|
415 | 416 | break |
|
416 | 417 | |
|
417 | 418 | self.__data_buffer[indexChannel,:] = result*volt_scale |
|
418 | 419 | |
|
419 | 420 | indexChannel += 1 |
|
420 | 421 | |
|
421 | 422 | dataOk = True |
|
422 | 423 | |
|
423 | 424 | self.__utctime = self.__thisUnixSample/self.__sample_rate |
|
424 | 425 | |
|
425 | 426 | if not dataOk: |
|
426 | 427 | return False |
|
427 | 428 | |
|
428 | 429 | print "[Reading] %s: %d samples <> %f sec" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
429 | 430 | self.__samples_to_read, |
|
430 | 431 | self.__timeInterval) |
|
431 | 432 | |
|
432 | 433 | self.__bufferIndex = 0 |
|
433 | 434 | |
|
434 | 435 | return True |
|
435 | 436 | |
|
436 | 437 | def __isBufferEmpty(self): |
|
437 | 438 | |
|
438 | 439 | if self.__bufferIndex <= self.__samples_to_read - self.__nSamples: |
|
439 | 440 | return False |
|
440 | 441 | |
|
441 | 442 | return True |
|
442 | 443 | |
|
443 | 444 | def getData(self, seconds=30, nTries=5): |
|
444 | 445 | |
|
445 | 446 | ''' |
|
446 | 447 | This method gets the data from files and put the data into the dataOut object |
|
447 | 448 | |
|
448 | 449 | In addition, increase el the buffer counter in one. |
|
449 | 450 | |
|
450 | 451 | Return: |
|
451 | 452 | data : retorna un perfil de voltages (alturas * canales) copiados desde el |
|
452 | 453 | buffer. Si no hay mas archivos a leer retorna None. |
|
453 | 454 | |
|
454 | 455 | Affected: |
|
455 | 456 | self.dataOut |
|
456 | 457 | self.profileIndex |
|
457 | 458 | self.flagDiscontinuousBlock |
|
458 | 459 | self.flagIsNewBlock |
|
459 | 460 | ''' |
|
460 | 461 | |
|
461 | 462 | err_counter = 0 |
|
462 | 463 | self.dataOut.flagNoData = True |
|
463 | 464 | |
|
464 | 465 | if self.__isBufferEmpty(): |
|
465 | 466 | |
|
466 | 467 | self.__flagDiscontinuousBlock = False |
|
467 | 468 | |
|
468 | 469 | while True: |
|
469 | 470 | if self.__readNextBlock(): |
|
470 | 471 | break |
|
471 | 472 | |
|
472 | 473 | if self.__thisUnixSample > self.__endUTCSecond*self.__sample_rate: |
|
473 | 474 | return False |
|
474 | 475 | |
|
475 | 476 | if self.__flagDiscontinuousBlock: |
|
476 | 477 | print '[Reading] discontinuous block found ... continue with the next block' |
|
477 | 478 | continue |
|
478 | 479 | |
|
479 | 480 | if not self.__online: |
|
480 | 481 | return False |
|
481 | 482 | |
|
482 | 483 | err_counter += 1 |
|
483 | 484 | if err_counter > nTries: |
|
484 | 485 | return False |
|
485 | 486 | |
|
486 | 487 | print '[Reading] waiting %d seconds to read a new block' %seconds |
|
487 | 488 | sleep(seconds) |
|
488 | 489 | |
|
489 | 490 | self.dataOut.data = self.__data_buffer[:,self.__bufferIndex:self.__bufferIndex+self.__nSamples] |
|
490 | 491 | self.dataOut.utctime = (self.__thisUnixSample + self.__bufferIndex)/self.__sample_rate |
|
491 | 492 | self.dataOut.flagNoData = False |
|
492 | 493 | self.dataOut.flagDiscontinuousBlock = self.__flagDiscontinuousBlock |
|
493 | 494 | |
|
494 | 495 | self.__bufferIndex += self.__nSamples |
|
495 | 496 | self.profileIndex += 1 |
|
496 | 497 | |
|
497 | 498 | return True |
|
498 | 499 | |
|
499 | 500 | def printInfo(self): |
|
500 | 501 | ''' |
|
501 | 502 | ''' |
|
502 | 503 | if self.__printInfo == False: |
|
503 | 504 | return |
|
504 | 505 | |
|
505 | 506 | # self.systemHeaderObj.printInfo() |
|
506 | 507 | # self.radarControllerHeaderObj.printInfo() |
|
507 | 508 | |
|
508 | 509 | self.__printInfo = False |
|
509 | 510 | |
|
510 | 511 | def printNumberOfBlock(self): |
|
511 | 512 | ''' |
|
512 | 513 | ''' |
|
513 | 514 | |
|
514 | 515 | print self.profileIndex |
|
515 | 516 | |
|
516 | 517 | def run(self, **kwargs): |
|
517 | 518 | ''' |
|
518 | 519 | This method will be called many times so here you should put all your code |
|
519 | 520 | ''' |
|
520 | 521 | |
|
521 | 522 | if not self.isConfig: |
|
522 | 523 | self.setup(**kwargs) |
|
523 | 524 | |
|
524 | 525 | self.getData(seconds=self.__delay) |
|
525 | 526 | |
|
526 | 527 | return |
|
527 | 528 | |
|
528 | 529 | class USRPWriter(Operation): |
|
529 | 530 | ''' |
|
530 | 531 | classdocs |
|
531 | 532 | ''' |
|
532 | 533 | |
|
533 | 534 | def __init__(self): |
|
534 | 535 | ''' |
|
535 | 536 | Constructor |
|
536 | 537 | ''' |
|
537 | 538 | self.dataOut = None |
|
538 | 539 | |
|
539 | 540 | def setup(self, dataIn, path, blocksPerFile, set=0, ext=None): |
|
540 | 541 | ''' |
|
541 | 542 | In this method we should set all initial parameters. |
|
542 | 543 | |
|
543 | 544 | Input: |
|
544 | 545 | dataIn : Input data will also be outputa data |
|
545 | 546 | |
|
546 | 547 | ''' |
|
547 | 548 | self.dataOut = dataIn |
|
548 | 549 | |
|
549 | 550 | |
|
550 | 551 | |
|
551 | 552 | |
|
552 | 553 | |
|
553 | 554 | self.isConfig = True |
|
554 | 555 | |
|
555 | 556 | return |
|
556 | 557 | |
|
557 | 558 | def run(self, dataIn, **kwargs): |
|
558 | 559 | ''' |
|
559 | 560 | This method will be called many times so here you should put all your code |
|
560 | 561 | |
|
561 | 562 | Inputs: |
|
562 | 563 | |
|
563 | 564 | dataIn : object with the data |
|
564 | 565 | |
|
565 | 566 | ''' |
|
566 | 567 | |
|
567 | 568 | if not self.isConfig: |
|
568 | 569 | self.setup(dataIn, **kwargs) |
|
569 | 570 | |
|
570 | 571 | |
|
571 | 572 | if __name__ == '__main__': |
|
572 | 573 | |
|
573 | 574 | readObj = USRPReader() |
|
574 | 575 | |
|
575 | 576 | while True: |
|
576 | 577 | readObj.run(path='/Volumes/DATA/haystack/passive_radar/') |
|
577 | 578 | # readObj.printInfo() |
|
578 | 579 | readObj.printNumberOfBlock() |
|
579 | 580 | |
|
580 | 581 | No newline at end of file |
@@ -1,978 +1,978 | |||
|
1 | 1 | import numpy |
|
2 | 2 | import math |
|
3 | 3 | |
|
4 | 4 | from jroproc_base import ProcessingUnit, Operation |
|
5 | 5 | from schainpy.model.data.jrodata import Spectra |
|
6 | 6 | from schainpy.model.data.jrodata import hildebrand_sekhon |
|
7 | 7 | |
|
8 | 8 | class SpectraProc(ProcessingUnit): |
|
9 | 9 | |
|
10 | 10 | def __init__(self): |
|
11 | 11 | |
|
12 | 12 | ProcessingUnit.__init__(self) |
|
13 | 13 | |
|
14 | 14 | self.buffer = None |
|
15 | 15 | self.firstdatatime = None |
|
16 | 16 | self.profIndex = 0 |
|
17 | 17 | self.dataOut = Spectra() |
|
18 | 18 | self.id_min = None |
|
19 | 19 | self.id_max = None |
|
20 | 20 | |
|
21 | 21 | def __updateObjFromInput(self): |
|
22 | 22 | |
|
23 | 23 | self.dataOut.timeZone = self.dataIn.timeZone |
|
24 | 24 | self.dataOut.dstFlag = self.dataIn.dstFlag |
|
25 | 25 | self.dataOut.errorCount = self.dataIn.errorCount |
|
26 | 26 | self.dataOut.useLocalTime = self.dataIn.useLocalTime |
|
27 | 27 | |
|
28 | 28 | self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy() |
|
29 | 29 | self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy() |
|
30 | 30 | self.dataOut.channelList = self.dataIn.channelList |
|
31 | 31 | self.dataOut.heightList = self.dataIn.heightList |
|
32 | 32 | self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
33 | 33 | # self.dataOut.nHeights = self.dataIn.nHeights |
|
34 | 34 | # self.dataOut.nChannels = self.dataIn.nChannels |
|
35 | 35 | self.dataOut.nBaud = self.dataIn.nBaud |
|
36 | 36 | self.dataOut.nCode = self.dataIn.nCode |
|
37 | 37 | self.dataOut.code = self.dataIn.code |
|
38 | 38 | self.dataOut.nProfiles = self.dataOut.nFFTPoints |
|
39 | 39 | # self.dataOut.channelIndexList = self.dataIn.channelIndexList |
|
40 | 40 | self.dataOut.flagDiscontinuousBlock = self.dataIn.flagDiscontinuousBlock |
|
41 | 41 | self.dataOut.utctime = self.firstdatatime |
|
42 | 42 | self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada |
|
43 | 43 | self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip |
|
44 | 44 | # self.dataOut.flagShiftFFT = self.dataIn.flagShiftFFT |
|
45 | 45 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
46 | 46 | self.dataOut.nIncohInt = 1 |
|
47 | 47 | # self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
48 | 48 | self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
49 | 49 | |
|
50 | 50 | # self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nIncohInt |
|
51 | 51 | self.dataOut.frequency = self.dataIn.frequency |
|
52 | 52 | self.dataOut.realtime = self.dataIn.realtime |
|
53 | 53 | |
|
54 | 54 | self.dataOut.azimuth = self.dataIn.azimuth |
|
55 | 55 | self.dataOut.zenith = self.dataIn.zenith |
|
56 | 56 | |
|
57 | 57 | self.dataOut.beam.codeList = self.dataIn.beam.codeList |
|
58 | 58 | self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList |
|
59 | 59 | self.dataOut.beam.zenithList = self.dataIn.beam.zenithList |
|
60 | 60 | |
|
61 | 61 | def __getFft(self): |
|
62 | 62 | """ |
|
63 | 63 | Convierte valores de Voltaje a Spectra |
|
64 | 64 | |
|
65 | 65 | Affected: |
|
66 | 66 | self.dataOut.data_spc |
|
67 | 67 | self.dataOut.data_cspc |
|
68 | 68 | self.dataOut.data_dc |
|
69 | 69 | self.dataOut.heightList |
|
70 | 70 | self.profIndex |
|
71 | 71 | self.buffer |
|
72 | 72 | self.dataOut.flagNoData |
|
73 | 73 | """ |
|
74 | 74 | fft_volt = numpy.fft.fft(self.buffer,n=self.dataOut.nFFTPoints,axis=1) |
|
75 | 75 | fft_volt = fft_volt.astype(numpy.dtype('complex')) |
|
76 | 76 | dc = fft_volt[:,0,:] |
|
77 | 77 | |
|
78 | 78 | #calculo de self-spectra |
|
79 | 79 | fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,)) |
|
80 | 80 | spc = fft_volt * numpy.conjugate(fft_volt) |
|
81 | 81 | spc = spc.real |
|
82 | 82 | |
|
83 | 83 | blocksize = 0 |
|
84 | 84 | blocksize += dc.size |
|
85 | 85 | blocksize += spc.size |
|
86 | 86 | |
|
87 | 87 | cspc = None |
|
88 | 88 | pairIndex = 0 |
|
89 | 89 | if self.dataOut.pairsList != None: |
|
90 | 90 | #calculo de cross-spectra |
|
91 | 91 | cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex') |
|
92 | 92 | for pair in self.dataOut.pairsList: |
|
93 | 93 | if pair[0] not in self.dataOut.channelList: |
|
94 |
raise ValueError, "Error getting CrossSpectra: pair 0 of |
|
|
94 | raise ValueError, "Error getting CrossSpectra: pair 0 of %s is not in channelList = %s" %(str(pair), str(self.dataOut.channelList)) | |
|
95 | 95 | if pair[1] not in self.dataOut.channelList: |
|
96 |
raise ValueError, "Error getting CrossSpectra: pair 1 of |
|
|
96 | raise ValueError, "Error getting CrossSpectra: pair 1 of %s is not in channelList = %s" %(str(pair), str(self.dataOut.channelList)) | |
|
97 | 97 | |
|
98 | 98 | cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:]) |
|
99 | 99 | pairIndex += 1 |
|
100 | 100 | blocksize += cspc.size |
|
101 | 101 | |
|
102 | 102 | self.dataOut.data_spc = spc |
|
103 | 103 | self.dataOut.data_cspc = cspc |
|
104 | 104 | self.dataOut.data_dc = dc |
|
105 | 105 | self.dataOut.blockSize = blocksize |
|
106 | 106 | self.dataOut.flagShiftFFT = False |
|
107 | 107 | |
|
108 | 108 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=[], ippFactor=None): |
|
109 | 109 | |
|
110 | 110 | self.dataOut.flagNoData = True |
|
111 | 111 | |
|
112 | 112 | if self.dataIn.type == "Spectra": |
|
113 | 113 | self.dataOut.copy(self.dataIn) |
|
114 | 114 | return True |
|
115 | 115 | |
|
116 | 116 | if self.dataIn.type == "Voltage": |
|
117 | 117 | |
|
118 | 118 | if nFFTPoints == None: |
|
119 | 119 | raise ValueError, "This SpectraProc.run() need nFFTPoints input variable" |
|
120 | 120 | |
|
121 | 121 | if nProfiles == None: |
|
122 | 122 | nProfiles = nFFTPoints |
|
123 | 123 | # raise ValueError, "This SpectraProc.run() need nProfiles input variable" |
|
124 | 124 | |
|
125 | 125 | |
|
126 | 126 | if ippFactor == None: |
|
127 | 127 | ippFactor = 1 |
|
128 | 128 | self.dataOut.ippFactor = ippFactor |
|
129 | 129 | |
|
130 | 130 | self.dataOut.nFFTPoints = nFFTPoints |
|
131 | 131 | self.dataOut.pairsList = pairsList |
|
132 | 132 | |
|
133 | 133 | if self.buffer == None: |
|
134 | 134 | self.buffer = numpy.zeros((self.dataIn.nChannels, |
|
135 | 135 | nProfiles, |
|
136 | 136 | self.dataIn.nHeights), |
|
137 | 137 | dtype='complex') |
|
138 | 138 | self.id_min = 0 |
|
139 | 139 | self.id_max = self.dataIn.data.shape[1] |
|
140 | 140 | |
|
141 | 141 | if len(self.dataIn.data.shape) == 2: |
|
142 | 142 | self.buffer[:,self.profIndex,:] = self.dataIn.data.copy() |
|
143 | 143 | self.profIndex += 1 |
|
144 | 144 | else: |
|
145 | 145 | if self.dataIn.data.shape[1] == nProfiles: |
|
146 | 146 | self.buffer = self.dataIn.data.copy() |
|
147 | 147 | self.profIndex = nProfiles |
|
148 | 148 | elif self.dataIn.data.shape[1] < nProfiles: |
|
149 | 149 | self.buffer[:,self.id_min:self.id_max,:] = self.dataIn.data |
|
150 | 150 | self.profIndex += self.dataIn.data.shape[1] |
|
151 | 151 | self.id_min += self.dataIn.data.shape[1] |
|
152 | 152 | self.id_max += self.dataIn.data.shape[1] |
|
153 | 153 | else: |
|
154 | 154 | raise ValueError, "The type object %s has %d profiles, it should be equal to %d profiles"%(self.dataIn.type,self.dataIn.data.shape[1],nProfiles) |
|
155 | 155 | self.dataOut.flagNoData = True |
|
156 | 156 | return 0 |
|
157 | 157 | |
|
158 | 158 | |
|
159 | 159 | if self.firstdatatime == None: |
|
160 | 160 | self.firstdatatime = self.dataIn.utctime |
|
161 | 161 | |
|
162 | 162 | if self.profIndex == nProfiles: |
|
163 | 163 | self.__updateObjFromInput() |
|
164 | 164 | self.__getFft() |
|
165 | 165 | |
|
166 | 166 | self.dataOut.flagNoData = False |
|
167 | 167 | |
|
168 | 168 | self.buffer = None |
|
169 | 169 | self.firstdatatime = None |
|
170 | 170 | self.profIndex = 0 |
|
171 | 171 | |
|
172 | 172 | return True |
|
173 | 173 | |
|
174 | 174 | raise ValueError, "The type of input object '%s' is not valid"%(self.dataIn.type) |
|
175 | 175 | |
|
176 | 176 | def __selectPairs(self, channelList=None): |
|
177 | 177 | |
|
178 | 178 | if channelList == None: |
|
179 | 179 | return |
|
180 | 180 | |
|
181 | 181 | pairsIndexListSelected = [] |
|
182 | 182 | for pairIndex in self.dataOut.pairsIndexList: |
|
183 | 183 | #First pair |
|
184 | 184 | if self.dataOut.pairsList[pairIndex][0] not in channelList: |
|
185 | 185 | continue |
|
186 | 186 | #Second pair |
|
187 | 187 | if self.dataOut.pairsList[pairIndex][1] not in channelList: |
|
188 | 188 | continue |
|
189 | 189 | |
|
190 | 190 | pairsIndexListSelected.append(pairIndex) |
|
191 | 191 | |
|
192 | 192 | if not pairsIndexListSelected: |
|
193 | 193 | self.dataOut.data_cspc = None |
|
194 | 194 | self.dataOut.pairsList = [] |
|
195 | 195 | return |
|
196 | 196 | |
|
197 | 197 | self.dataOut.data_cspc = self.dataOut.data_cspc[pairsIndexListSelected] |
|
198 | 198 | self.dataOut.pairsList = self.dataOut.pairsList[pairsIndexListSelected] |
|
199 | 199 | |
|
200 | 200 | return |
|
201 | 201 | |
|
202 | 202 | def selectChannels(self, channelList): |
|
203 | 203 | |
|
204 | 204 | channelIndexList = [] |
|
205 | 205 | |
|
206 | 206 | for channel in channelList: |
|
207 | 207 | if channel not in self.dataOut.channelList: |
|
208 | 208 | raise ValueError, "Error selecting channels: The value %d in channelList is not valid.\nAvailable channels = %s" %(channel, str(self.dataOut.channelList)) |
|
209 | 209 | |
|
210 | 210 | index = self.dataOut.channelList.index(channel) |
|
211 | 211 | channelIndexList.append(index) |
|
212 | 212 | |
|
213 | 213 | self.selectChannelsByIndex(channelIndexList) |
|
214 | 214 | |
|
215 | 215 | def selectChannelsByIndex(self, channelIndexList): |
|
216 | 216 | """ |
|
217 | 217 | Selecciona un bloque de datos en base a canales segun el channelIndexList |
|
218 | 218 | |
|
219 | 219 | Input: |
|
220 | 220 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] |
|
221 | 221 | |
|
222 | 222 | Affected: |
|
223 | 223 | self.dataOut.data_spc |
|
224 | 224 | self.dataOut.channelIndexList |
|
225 | 225 | self.dataOut.nChannels |
|
226 | 226 | |
|
227 | 227 | Return: |
|
228 | 228 | None |
|
229 | 229 | """ |
|
230 | 230 | |
|
231 | 231 | for channelIndex in channelIndexList: |
|
232 | 232 | if channelIndex not in self.dataOut.channelIndexList: |
|
233 | 233 | raise ValueError, "Error selecting channels: The value %d in channelIndexList is not valid.\nAvailable channel indexes = " %(channelIndex, self.dataOut.channelIndexList) |
|
234 | 234 | |
|
235 | 235 | # nChannels = len(channelIndexList) |
|
236 | 236 | |
|
237 | 237 | data_spc = self.dataOut.data_spc[channelIndexList,:] |
|
238 | 238 | data_dc = self.dataOut.data_dc[channelIndexList,:] |
|
239 | 239 | |
|
240 | 240 | self.dataOut.data_spc = data_spc |
|
241 | 241 | self.dataOut.data_dc = data_dc |
|
242 | 242 | |
|
243 | 243 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
244 | 244 | # self.dataOut.nChannels = nChannels |
|
245 | 245 | |
|
246 | 246 | self.__selectPairs(self.dataOut.channelList) |
|
247 | 247 | |
|
248 | 248 | return 1 |
|
249 | 249 | |
|
250 | 250 | def selectHeights(self, minHei, maxHei): |
|
251 | 251 | """ |
|
252 | 252 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango |
|
253 | 253 | minHei <= height <= maxHei |
|
254 | 254 | |
|
255 | 255 | Input: |
|
256 | 256 | minHei : valor minimo de altura a considerar |
|
257 | 257 | maxHei : valor maximo de altura a considerar |
|
258 | 258 | |
|
259 | 259 | Affected: |
|
260 | 260 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex |
|
261 | 261 | |
|
262 | 262 | Return: |
|
263 | 263 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
264 | 264 | """ |
|
265 | 265 | |
|
266 | 266 | if (minHei > maxHei): |
|
267 | 267 | raise ValueError, "Error selecting heights: Height range (%d,%d) is not valid" % (minHei, maxHei) |
|
268 | 268 | |
|
269 | 269 | if (minHei < self.dataOut.heightList[0]): |
|
270 | 270 | minHei = self.dataOut.heightList[0] |
|
271 | 271 | |
|
272 | 272 | if (maxHei > self.dataOut.heightList[-1]): |
|
273 | 273 | maxHei = self.dataOut.heightList[-1] |
|
274 | 274 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
275 | 275 | |
|
276 | 276 | minIndex = 0 |
|
277 | 277 | maxIndex = 0 |
|
278 | 278 | heights = self.dataOut.heightList |
|
279 | 279 | |
|
280 | 280 | inda = numpy.where(heights >= minHei) |
|
281 | 281 | indb = numpy.where(heights <= maxHei) |
|
282 | 282 | |
|
283 | 283 | try: |
|
284 | 284 | minIndex = inda[0][0] |
|
285 | 285 | except: |
|
286 | 286 | minIndex = 0 |
|
287 | 287 | |
|
288 | 288 | try: |
|
289 | 289 | maxIndex = indb[0][-1] |
|
290 | 290 | except: |
|
291 | 291 | maxIndex = len(heights) |
|
292 | 292 | |
|
293 | 293 | self.selectHeightsByIndex(minIndex, maxIndex) |
|
294 | 294 | |
|
295 | 295 | return 1 |
|
296 | 296 | |
|
297 | 297 | def getBeaconSignal(self, tauindex = 0, channelindex = 0, hei_ref=None): |
|
298 | 298 | newheis = numpy.where(self.dataOut.heightList>self.dataOut.radarControllerHeaderObj.Taus[tauindex]) |
|
299 | 299 | |
|
300 | 300 | if hei_ref != None: |
|
301 | 301 | newheis = numpy.where(self.dataOut.heightList>hei_ref) |
|
302 | 302 | |
|
303 | 303 | minIndex = min(newheis[0]) |
|
304 | 304 | maxIndex = max(newheis[0]) |
|
305 | 305 | data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1] |
|
306 | 306 | heightList = self.dataOut.heightList[minIndex:maxIndex+1] |
|
307 | 307 | |
|
308 | 308 | # determina indices |
|
309 | 309 | nheis = int(self.dataOut.radarControllerHeaderObj.txB/(self.dataOut.heightList[1]-self.dataOut.heightList[0])) |
|
310 | 310 | avg_dB = 10*numpy.log10(numpy.sum(data_spc[channelindex,:,:],axis=0)) |
|
311 | 311 | beacon_dB = numpy.sort(avg_dB)[-nheis:] |
|
312 | 312 | beacon_heiIndexList = [] |
|
313 | 313 | for val in avg_dB.tolist(): |
|
314 | 314 | if val >= beacon_dB[0]: |
|
315 | 315 | beacon_heiIndexList.append(avg_dB.tolist().index(val)) |
|
316 | 316 | |
|
317 | 317 | #data_spc = data_spc[:,:,beacon_heiIndexList] |
|
318 | 318 | data_cspc = None |
|
319 | 319 | if self.dataOut.data_cspc != None: |
|
320 | 320 | data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1] |
|
321 | 321 | #data_cspc = data_cspc[:,:,beacon_heiIndexList] |
|
322 | 322 | |
|
323 | 323 | data_dc = None |
|
324 | 324 | if self.dataOut.data_dc != None: |
|
325 | 325 | data_dc = self.dataOut.data_dc[:,minIndex:maxIndex+1] |
|
326 | 326 | #data_dc = data_dc[:,beacon_heiIndexList] |
|
327 | 327 | |
|
328 | 328 | self.dataOut.data_spc = data_spc |
|
329 | 329 | self.dataOut.data_cspc = data_cspc |
|
330 | 330 | self.dataOut.data_dc = data_dc |
|
331 | 331 | self.dataOut.heightList = heightList |
|
332 | 332 | self.dataOut.beacon_heiIndexList = beacon_heiIndexList |
|
333 | 333 | |
|
334 | 334 | return 1 |
|
335 | 335 | |
|
336 | 336 | |
|
337 | 337 | def selectHeightsByIndex(self, minIndex, maxIndex): |
|
338 | 338 | """ |
|
339 | 339 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango |
|
340 | 340 | minIndex <= index <= maxIndex |
|
341 | 341 | |
|
342 | 342 | Input: |
|
343 | 343 | minIndex : valor de indice minimo de altura a considerar |
|
344 | 344 | maxIndex : valor de indice maximo de altura a considerar |
|
345 | 345 | |
|
346 | 346 | Affected: |
|
347 | 347 | self.dataOut.data_spc |
|
348 | 348 | self.dataOut.data_cspc |
|
349 | 349 | self.dataOut.data_dc |
|
350 | 350 | self.dataOut.heightList |
|
351 | 351 | |
|
352 | 352 | Return: |
|
353 | 353 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
354 | 354 | """ |
|
355 | 355 | |
|
356 | 356 | if (minIndex < 0) or (minIndex > maxIndex): |
|
357 | 357 | raise ValueError, "Error selecting heights by index: Index range in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
358 | 358 | |
|
359 | 359 | if (maxIndex >= self.dataOut.nHeights): |
|
360 | 360 | maxIndex = self.dataOut.nHeights-1 |
|
361 | 361 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
362 | 362 | |
|
363 | 363 | # nHeights = maxIndex - minIndex + 1 |
|
364 | 364 | |
|
365 | 365 | #Spectra |
|
366 | 366 | data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1] |
|
367 | 367 | |
|
368 | 368 | data_cspc = None |
|
369 | 369 | if self.dataOut.data_cspc != None: |
|
370 | 370 | data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1] |
|
371 | 371 | |
|
372 | 372 | data_dc = None |
|
373 | 373 | if self.dataOut.data_dc != None: |
|
374 | 374 | data_dc = self.dataOut.data_dc[:,minIndex:maxIndex+1] |
|
375 | 375 | |
|
376 | 376 | self.dataOut.data_spc = data_spc |
|
377 | 377 | self.dataOut.data_cspc = data_cspc |
|
378 | 378 | self.dataOut.data_dc = data_dc |
|
379 | 379 | |
|
380 | 380 | self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1] |
|
381 | 381 | |
|
382 | 382 | return 1 |
|
383 | 383 | |
|
384 | 384 | def removeDC(self, mode = 2): |
|
385 | 385 | jspectra = self.dataOut.data_spc |
|
386 | 386 | jcspectra = self.dataOut.data_cspc |
|
387 | 387 | |
|
388 | 388 | |
|
389 | 389 | num_chan = jspectra.shape[0] |
|
390 | 390 | num_hei = jspectra.shape[2] |
|
391 | 391 | |
|
392 | 392 | if jcspectra != None: |
|
393 | 393 | jcspectraExist = True |
|
394 | 394 | num_pairs = jcspectra.shape[0] |
|
395 | 395 | else: jcspectraExist = False |
|
396 | 396 | |
|
397 | 397 | freq_dc = jspectra.shape[1]/2 |
|
398 | 398 | ind_vel = numpy.array([-2,-1,1,2]) + freq_dc |
|
399 | 399 | |
|
400 | 400 | if ind_vel[0]<0: |
|
401 | 401 | ind_vel[range(0,1)] = ind_vel[range(0,1)] + self.num_prof |
|
402 | 402 | |
|
403 | 403 | if mode == 1: |
|
404 | 404 | jspectra[:,freq_dc,:] = (jspectra[:,ind_vel[1],:] + jspectra[:,ind_vel[2],:])/2 #CORRECCION |
|
405 | 405 | |
|
406 | 406 | if jcspectraExist: |
|
407 | 407 | jcspectra[:,freq_dc,:] = (jcspectra[:,ind_vel[1],:] + jcspectra[:,ind_vel[2],:])/2 |
|
408 | 408 | |
|
409 | 409 | if mode == 2: |
|
410 | 410 | |
|
411 | 411 | vel = numpy.array([-2,-1,1,2]) |
|
412 | 412 | xx = numpy.zeros([4,4]) |
|
413 | 413 | |
|
414 | 414 | for fil in range(4): |
|
415 | 415 | xx[fil,:] = vel[fil]**numpy.asarray(range(4)) |
|
416 | 416 | |
|
417 | 417 | xx_inv = numpy.linalg.inv(xx) |
|
418 | 418 | xx_aux = xx_inv[0,:] |
|
419 | 419 | |
|
420 | 420 | for ich in range(num_chan): |
|
421 | 421 | yy = jspectra[ich,ind_vel,:] |
|
422 | 422 | jspectra[ich,freq_dc,:] = numpy.dot(xx_aux,yy) |
|
423 | 423 | |
|
424 | 424 | junkid = jspectra[ich,freq_dc,:]<=0 |
|
425 | 425 | cjunkid = sum(junkid) |
|
426 | 426 | |
|
427 | 427 | if cjunkid.any(): |
|
428 | 428 | jspectra[ich,freq_dc,junkid.nonzero()] = (jspectra[ich,ind_vel[1],junkid] + jspectra[ich,ind_vel[2],junkid])/2 |
|
429 | 429 | |
|
430 | 430 | if jcspectraExist: |
|
431 | 431 | for ip in range(num_pairs): |
|
432 | 432 | yy = jcspectra[ip,ind_vel,:] |
|
433 | 433 | jcspectra[ip,freq_dc,:] = numpy.dot(xx_aux,yy) |
|
434 | 434 | |
|
435 | 435 | |
|
436 | 436 | self.dataOut.data_spc = jspectra |
|
437 | 437 | self.dataOut.data_cspc = jcspectra |
|
438 | 438 | |
|
439 | 439 | return 1 |
|
440 | 440 | |
|
441 | 441 | def removeInterference(self, interf = 2,hei_interf = None, nhei_interf = None, offhei_interf = None): |
|
442 | 442 | |
|
443 | 443 | jspectra = self.dataOut.data_spc |
|
444 | 444 | jcspectra = self.dataOut.data_cspc |
|
445 | 445 | jnoise = self.dataOut.getNoise() |
|
446 | 446 | num_incoh = self.dataOut.nIncohInt |
|
447 | 447 | |
|
448 | 448 | num_channel = jspectra.shape[0] |
|
449 | 449 | num_prof = jspectra.shape[1] |
|
450 | 450 | num_hei = jspectra.shape[2] |
|
451 | 451 | |
|
452 | 452 | #hei_interf |
|
453 | 453 | if hei_interf == None: |
|
454 | 454 | count_hei = num_hei/2 #Como es entero no importa |
|
455 | 455 | hei_interf = numpy.asmatrix(range(count_hei)) + num_hei - count_hei |
|
456 | 456 | hei_interf = numpy.asarray(hei_interf)[0] |
|
457 | 457 | #nhei_interf |
|
458 | 458 | if (nhei_interf == None): |
|
459 | 459 | nhei_interf = 5 |
|
460 | 460 | if (nhei_interf < 1): |
|
461 | 461 | nhei_interf = 1 |
|
462 | 462 | if (nhei_interf > count_hei): |
|
463 | 463 | nhei_interf = count_hei |
|
464 | 464 | if (offhei_interf == None): |
|
465 | 465 | offhei_interf = 0 |
|
466 | 466 | |
|
467 | 467 | ind_hei = range(num_hei) |
|
468 | 468 | # mask_prof = numpy.asarray(range(num_prof - 2)) + 1 |
|
469 | 469 | # mask_prof[range(num_prof/2 - 1,len(mask_prof))] += 1 |
|
470 | 470 | mask_prof = numpy.asarray(range(num_prof)) |
|
471 | 471 | num_mask_prof = mask_prof.size |
|
472 | 472 | comp_mask_prof = [0, num_prof/2] |
|
473 | 473 | |
|
474 | 474 | |
|
475 | 475 | #noise_exist: Determina si la variable jnoise ha sido definida y contiene la informacion del ruido de cada canal |
|
476 | 476 | if (jnoise.size < num_channel or numpy.isnan(jnoise).any()): |
|
477 | 477 | jnoise = numpy.nan |
|
478 | 478 | noise_exist = jnoise[0] < numpy.Inf |
|
479 | 479 | |
|
480 | 480 | #Subrutina de Remocion de la Interferencia |
|
481 | 481 | for ich in range(num_channel): |
|
482 | 482 | #Se ordena los espectros segun su potencia (menor a mayor) |
|
483 | 483 | power = jspectra[ich,mask_prof,:] |
|
484 | 484 | power = power[:,hei_interf] |
|
485 | 485 | power = power.sum(axis = 0) |
|
486 | 486 | psort = power.ravel().argsort() |
|
487 | 487 | |
|
488 | 488 | #Se estima la interferencia promedio en los Espectros de Potencia empleando |
|
489 | 489 | junkspc_interf = jspectra[ich,:,hei_interf[psort[range(offhei_interf, nhei_interf + offhei_interf)]]] |
|
490 | 490 | |
|
491 | 491 | if noise_exist: |
|
492 | 492 | # tmp_noise = jnoise[ich] / num_prof |
|
493 | 493 | tmp_noise = jnoise[ich] |
|
494 | 494 | junkspc_interf = junkspc_interf - tmp_noise |
|
495 | 495 | #junkspc_interf[:,comp_mask_prof] = 0 |
|
496 | 496 | |
|
497 | 497 | jspc_interf = junkspc_interf.sum(axis = 0) / nhei_interf |
|
498 | 498 | jspc_interf = jspc_interf.transpose() |
|
499 | 499 | #Calculando el espectro de interferencia promedio |
|
500 | 500 | noiseid = numpy.where(jspc_interf <= tmp_noise/ math.sqrt(num_incoh)) |
|
501 | 501 | noiseid = noiseid[0] |
|
502 | 502 | cnoiseid = noiseid.size |
|
503 | 503 | interfid = numpy.where(jspc_interf > tmp_noise/ math.sqrt(num_incoh)) |
|
504 | 504 | interfid = interfid[0] |
|
505 | 505 | cinterfid = interfid.size |
|
506 | 506 | |
|
507 | 507 | if (cnoiseid > 0): jspc_interf[noiseid] = 0 |
|
508 | 508 | |
|
509 | 509 | #Expandiendo los perfiles a limpiar |
|
510 | 510 | if (cinterfid > 0): |
|
511 | 511 | new_interfid = (numpy.r_[interfid - 1, interfid, interfid + 1] + num_prof)%num_prof |
|
512 | 512 | new_interfid = numpy.asarray(new_interfid) |
|
513 | 513 | new_interfid = {x for x in new_interfid} |
|
514 | 514 | new_interfid = numpy.array(list(new_interfid)) |
|
515 | 515 | new_cinterfid = new_interfid.size |
|
516 | 516 | else: new_cinterfid = 0 |
|
517 | 517 | |
|
518 | 518 | for ip in range(new_cinterfid): |
|
519 | 519 | ind = junkspc_interf[:,new_interfid[ip]].ravel().argsort() |
|
520 | 520 | jspc_interf[new_interfid[ip]] = junkspc_interf[ind[nhei_interf/2],new_interfid[ip]] |
|
521 | 521 | |
|
522 | 522 | |
|
523 | 523 | jspectra[ich,:,ind_hei] = jspectra[ich,:,ind_hei] - jspc_interf #Corregir indices |
|
524 | 524 | |
|
525 | 525 | #Removiendo la interferencia del punto de mayor interferencia |
|
526 | 526 | ListAux = jspc_interf[mask_prof].tolist() |
|
527 | 527 | maxid = ListAux.index(max(ListAux)) |
|
528 | 528 | |
|
529 | 529 | |
|
530 | 530 | if cinterfid > 0: |
|
531 | 531 | for ip in range(cinterfid*(interf == 2) - 1): |
|
532 | 532 | ind = (jspectra[ich,interfid[ip],:] < tmp_noise*(1 + 1/math.sqrt(num_incoh))).nonzero() |
|
533 | 533 | cind = len(ind) |
|
534 | 534 | |
|
535 | 535 | if (cind > 0): |
|
536 | 536 | jspectra[ich,interfid[ip],ind] = tmp_noise*(1 + (numpy.random.uniform(cind) - 0.5)/math.sqrt(num_incoh)) |
|
537 | 537 | |
|
538 | 538 | ind = numpy.array([-2,-1,1,2]) |
|
539 | 539 | xx = numpy.zeros([4,4]) |
|
540 | 540 | |
|
541 | 541 | for id1 in range(4): |
|
542 | 542 | xx[:,id1] = ind[id1]**numpy.asarray(range(4)) |
|
543 | 543 | |
|
544 | 544 | xx_inv = numpy.linalg.inv(xx) |
|
545 | 545 | xx = xx_inv[:,0] |
|
546 | 546 | ind = (ind + maxid + num_mask_prof)%num_mask_prof |
|
547 | 547 | yy = jspectra[ich,mask_prof[ind],:] |
|
548 | 548 | jspectra[ich,mask_prof[maxid],:] = numpy.dot(yy.transpose(),xx) |
|
549 | 549 | |
|
550 | 550 | |
|
551 | 551 | indAux = (jspectra[ich,:,:] < tmp_noise*(1-1/math.sqrt(num_incoh))).nonzero() |
|
552 | 552 | jspectra[ich,indAux[0],indAux[1]] = tmp_noise * (1 - 1/math.sqrt(num_incoh)) |
|
553 | 553 | |
|
554 | 554 | #Remocion de Interferencia en el Cross Spectra |
|
555 | 555 | if jcspectra == None: return jspectra, jcspectra |
|
556 | 556 | num_pairs = jcspectra.size/(num_prof*num_hei) |
|
557 | 557 | jcspectra = jcspectra.reshape(num_pairs, num_prof, num_hei) |
|
558 | 558 | |
|
559 | 559 | for ip in range(num_pairs): |
|
560 | 560 | |
|
561 | 561 | #------------------------------------------- |
|
562 | 562 | |
|
563 | 563 | cspower = numpy.abs(jcspectra[ip,mask_prof,:]) |
|
564 | 564 | cspower = cspower[:,hei_interf] |
|
565 | 565 | cspower = cspower.sum(axis = 0) |
|
566 | 566 | |
|
567 | 567 | cspsort = cspower.ravel().argsort() |
|
568 | 568 | junkcspc_interf = jcspectra[ip,:,hei_interf[cspsort[range(offhei_interf, nhei_interf + offhei_interf)]]] |
|
569 | 569 | junkcspc_interf = junkcspc_interf.transpose() |
|
570 | 570 | jcspc_interf = junkcspc_interf.sum(axis = 1)/nhei_interf |
|
571 | 571 | |
|
572 | 572 | ind = numpy.abs(jcspc_interf[mask_prof]).ravel().argsort() |
|
573 | 573 | |
|
574 | 574 | median_real = numpy.median(numpy.real(junkcspc_interf[mask_prof[ind[range(3*num_prof/4)]],:])) |
|
575 | 575 | median_imag = numpy.median(numpy.imag(junkcspc_interf[mask_prof[ind[range(3*num_prof/4)]],:])) |
|
576 | 576 | junkcspc_interf[comp_mask_prof,:] = numpy.complex(median_real, median_imag) |
|
577 | 577 | |
|
578 | 578 | for iprof in range(num_prof): |
|
579 | 579 | ind = numpy.abs(junkcspc_interf[iprof,:]).ravel().argsort() |
|
580 | 580 | jcspc_interf[iprof] = junkcspc_interf[iprof, ind[nhei_interf/2]] |
|
581 | 581 | |
|
582 | 582 | #Removiendo la Interferencia |
|
583 | 583 | jcspectra[ip,:,ind_hei] = jcspectra[ip,:,ind_hei] - jcspc_interf |
|
584 | 584 | |
|
585 | 585 | ListAux = numpy.abs(jcspc_interf[mask_prof]).tolist() |
|
586 | 586 | maxid = ListAux.index(max(ListAux)) |
|
587 | 587 | |
|
588 | 588 | ind = numpy.array([-2,-1,1,2]) |
|
589 | 589 | xx = numpy.zeros([4,4]) |
|
590 | 590 | |
|
591 | 591 | for id1 in range(4): |
|
592 | 592 | xx[:,id1] = ind[id1]**numpy.asarray(range(4)) |
|
593 | 593 | |
|
594 | 594 | xx_inv = numpy.linalg.inv(xx) |
|
595 | 595 | xx = xx_inv[:,0] |
|
596 | 596 | |
|
597 | 597 | ind = (ind + maxid + num_mask_prof)%num_mask_prof |
|
598 | 598 | yy = jcspectra[ip,mask_prof[ind],:] |
|
599 | 599 | jcspectra[ip,mask_prof[maxid],:] = numpy.dot(yy.transpose(),xx) |
|
600 | 600 | |
|
601 | 601 | #Guardar Resultados |
|
602 | 602 | self.dataOut.data_spc = jspectra |
|
603 | 603 | self.dataOut.data_cspc = jcspectra |
|
604 | 604 | |
|
605 | 605 | return 1 |
|
606 | 606 | |
|
607 | 607 | def setRadarFrequency(self, frequency=None): |
|
608 | 608 | if frequency != None: |
|
609 | 609 | self.dataOut.frequency = frequency |
|
610 | 610 | |
|
611 | 611 | return 1 |
|
612 | 612 | |
|
613 | 613 | def getNoise(self, minHei=None, maxHei=None, minVel=None, maxVel=None): |
|
614 | 614 | #validacion de rango |
|
615 | 615 | if minHei == None: |
|
616 | 616 | minHei = self.dataOut.heightList[0] |
|
617 | 617 | |
|
618 | 618 | if maxHei == None: |
|
619 | 619 | maxHei = self.dataOut.heightList[-1] |
|
620 | 620 | |
|
621 | 621 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): |
|
622 | 622 | print 'minHei: %.2f is out of the heights range'%(minHei) |
|
623 | 623 | print 'minHei is setting to %.2f'%(self.dataOut.heightList[0]) |
|
624 | 624 | minHei = self.dataOut.heightList[0] |
|
625 | 625 | |
|
626 | 626 | if (maxHei > self.dataOut.heightList[-1]) or (maxHei < minHei): |
|
627 | 627 | print 'maxHei: %.2f is out of the heights range'%(maxHei) |
|
628 | 628 | print 'maxHei is setting to %.2f'%(self.dataOut.heightList[-1]) |
|
629 | 629 | maxHei = self.dataOut.heightList[-1] |
|
630 | 630 | |
|
631 | 631 | # validacion de velocidades |
|
632 | 632 | velrange = self.dataOut.getVelRange(1) |
|
633 | 633 | |
|
634 | 634 | if minVel == None: |
|
635 | 635 | minVel = velrange[0] |
|
636 | 636 | |
|
637 | 637 | if maxVel == None: |
|
638 | 638 | maxVel = velrange[-1] |
|
639 | 639 | |
|
640 | 640 | if (minVel < velrange[0]) or (minVel > maxVel): |
|
641 | 641 | print 'minVel: %.2f is out of the velocity range'%(minVel) |
|
642 | 642 | print 'minVel is setting to %.2f'%(velrange[0]) |
|
643 | 643 | minVel = velrange[0] |
|
644 | 644 | |
|
645 | 645 | if (maxVel > velrange[-1]) or (maxVel < minVel): |
|
646 | 646 | print 'maxVel: %.2f is out of the velocity range'%(maxVel) |
|
647 | 647 | print 'maxVel is setting to %.2f'%(velrange[-1]) |
|
648 | 648 | maxVel = velrange[-1] |
|
649 | 649 | |
|
650 | 650 | # seleccion de indices para rango |
|
651 | 651 | minIndex = 0 |
|
652 | 652 | maxIndex = 0 |
|
653 | 653 | heights = self.dataOut.heightList |
|
654 | 654 | |
|
655 | 655 | inda = numpy.where(heights >= minHei) |
|
656 | 656 | indb = numpy.where(heights <= maxHei) |
|
657 | 657 | |
|
658 | 658 | try: |
|
659 | 659 | minIndex = inda[0][0] |
|
660 | 660 | except: |
|
661 | 661 | minIndex = 0 |
|
662 | 662 | |
|
663 | 663 | try: |
|
664 | 664 | maxIndex = indb[0][-1] |
|
665 | 665 | except: |
|
666 | 666 | maxIndex = len(heights) |
|
667 | 667 | |
|
668 | 668 | if (minIndex < 0) or (minIndex > maxIndex): |
|
669 | 669 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
670 | 670 | |
|
671 | 671 | if (maxIndex >= self.dataOut.nHeights): |
|
672 | 672 | maxIndex = self.dataOut.nHeights-1 |
|
673 | 673 | |
|
674 | 674 | # seleccion de indices para velocidades |
|
675 | 675 | indminvel = numpy.where(velrange >= minVel) |
|
676 | 676 | indmaxvel = numpy.where(velrange <= maxVel) |
|
677 | 677 | try: |
|
678 | 678 | minIndexVel = indminvel[0][0] |
|
679 | 679 | except: |
|
680 | 680 | minIndexVel = 0 |
|
681 | 681 | |
|
682 | 682 | try: |
|
683 | 683 | maxIndexVel = indmaxvel[0][-1] |
|
684 | 684 | except: |
|
685 | 685 | maxIndexVel = len(velrange) |
|
686 | 686 | |
|
687 | 687 | #seleccion del espectro |
|
688 | 688 | data_spc = self.dataOut.data_spc[:,minIndexVel:maxIndexVel+1,minIndex:maxIndex+1] |
|
689 | 689 | #estimacion de ruido |
|
690 | 690 | noise = numpy.zeros(self.dataOut.nChannels) |
|
691 | 691 | |
|
692 | 692 | for channel in range(self.dataOut.nChannels): |
|
693 | 693 | daux = data_spc[channel,:,:] |
|
694 | 694 | noise[channel] = hildebrand_sekhon(daux, self.dataOut.nIncohInt) |
|
695 | 695 | |
|
696 | 696 | self.dataOut.noise_estimation = noise.copy() |
|
697 | 697 | |
|
698 | 698 | return 1 |
|
699 | 699 | |
|
700 | 700 | class IncohInt(Operation): |
|
701 | 701 | |
|
702 | 702 | |
|
703 | 703 | __profIndex = 0 |
|
704 | 704 | __withOverapping = False |
|
705 | 705 | |
|
706 | 706 | __byTime = False |
|
707 | 707 | __initime = None |
|
708 | 708 | __lastdatatime = None |
|
709 | 709 | __integrationtime = None |
|
710 | 710 | |
|
711 | 711 | __buffer_spc = None |
|
712 | 712 | __buffer_cspc = None |
|
713 | 713 | __buffer_dc = None |
|
714 | 714 | |
|
715 | 715 | __dataReady = False |
|
716 | 716 | |
|
717 | 717 | __timeInterval = None |
|
718 | 718 | |
|
719 | 719 | n = None |
|
720 | 720 | |
|
721 | 721 | |
|
722 | 722 | |
|
723 | 723 | def __init__(self): |
|
724 | 724 | |
|
725 | 725 | Operation.__init__(self) |
|
726 | 726 | # self.isConfig = False |
|
727 | 727 | |
|
728 | 728 | def setup(self, n=None, timeInterval=None, overlapping=False): |
|
729 | 729 | """ |
|
730 | 730 | Set the parameters of the integration class. |
|
731 | 731 | |
|
732 | 732 | Inputs: |
|
733 | 733 | |
|
734 | 734 | n : Number of coherent integrations |
|
735 | 735 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work |
|
736 | 736 | overlapping : |
|
737 | 737 | |
|
738 | 738 | """ |
|
739 | 739 | |
|
740 | 740 | self.__initime = None |
|
741 | 741 | self.__lastdatatime = 0 |
|
742 | 742 | self.__buffer_spc = None |
|
743 | 743 | self.__buffer_cspc = None |
|
744 | 744 | self.__buffer_dc = None |
|
745 | 745 | self.__dataReady = False |
|
746 | 746 | |
|
747 | 747 | |
|
748 | 748 | if n == None and timeInterval == None: |
|
749 | 749 | raise ValueError, "n or timeInterval should be specified ..." |
|
750 | 750 | |
|
751 | 751 | if n != None: |
|
752 | 752 | self.n = n |
|
753 | 753 | self.__byTime = False |
|
754 | 754 | else: |
|
755 | 755 | self.__integrationtime = timeInterval #if (type(timeInterval)!=integer) -> change this line |
|
756 | 756 | self.n = 9999 |
|
757 | 757 | self.__byTime = True |
|
758 | 758 | |
|
759 | 759 | if overlapping: |
|
760 | 760 | self.__withOverapping = True |
|
761 | 761 | else: |
|
762 | 762 | self.__withOverapping = False |
|
763 | 763 | self.__buffer_spc = 0 |
|
764 | 764 | self.__buffer_cspc = 0 |
|
765 | 765 | self.__buffer_dc = 0 |
|
766 | 766 | |
|
767 | 767 | self.__profIndex = 0 |
|
768 | 768 | |
|
769 | 769 | def putData(self, data_spc, data_cspc, data_dc): |
|
770 | 770 | |
|
771 | 771 | """ |
|
772 | 772 | Add a profile to the __buffer_spc and increase in one the __profileIndex |
|
773 | 773 | |
|
774 | 774 | """ |
|
775 | 775 | |
|
776 | 776 | if not self.__withOverapping: |
|
777 | 777 | self.__buffer_spc += data_spc |
|
778 | 778 | |
|
779 | 779 | if data_cspc == None: |
|
780 | 780 | self.__buffer_cspc = None |
|
781 | 781 | else: |
|
782 | 782 | self.__buffer_cspc += data_cspc |
|
783 | 783 | |
|
784 | 784 | if data_dc == None: |
|
785 | 785 | self.__buffer_dc = None |
|
786 | 786 | else: |
|
787 | 787 | self.__buffer_dc += data_dc |
|
788 | 788 | |
|
789 | 789 | self.__profIndex += 1 |
|
790 | 790 | return |
|
791 | 791 | |
|
792 | 792 | #Overlapping data |
|
793 | 793 | nChannels, nFFTPoints, nHeis = data_spc.shape |
|
794 | 794 | data_spc = numpy.reshape(data_spc, (1, nChannels, nFFTPoints, nHeis)) |
|
795 | 795 | if data_cspc != None: |
|
796 | 796 | data_cspc = numpy.reshape(data_cspc, (1, -1, nFFTPoints, nHeis)) |
|
797 | 797 | if data_dc != None: |
|
798 | 798 | data_dc = numpy.reshape(data_dc, (1, -1, nHeis)) |
|
799 | 799 | |
|
800 | 800 | #If the buffer is empty then it takes the data value |
|
801 | 801 | if self.__buffer_spc == None: |
|
802 | 802 | self.__buffer_spc = data_spc |
|
803 | 803 | |
|
804 | 804 | if data_cspc == None: |
|
805 | 805 | self.__buffer_cspc = None |
|
806 | 806 | else: |
|
807 | 807 | self.__buffer_cspc += data_cspc |
|
808 | 808 | |
|
809 | 809 | if data_dc == None: |
|
810 | 810 | self.__buffer_dc = None |
|
811 | 811 | else: |
|
812 | 812 | self.__buffer_dc += data_dc |
|
813 | 813 | |
|
814 | 814 | self.__profIndex += 1 |
|
815 | 815 | return |
|
816 | 816 | |
|
817 | 817 | #If the buffer length is lower than n then stakcing the data value |
|
818 | 818 | if self.__profIndex < self.n: |
|
819 | 819 | self.__buffer_spc = numpy.vstack((self.__buffer_spc, data_spc)) |
|
820 | 820 | |
|
821 | 821 | if data_cspc != None: |
|
822 | 822 | self.__buffer_cspc = numpy.vstack((self.__buffer_cspc, data_cspc)) |
|
823 | 823 | |
|
824 | 824 | if data_dc != None: |
|
825 | 825 | self.__buffer_dc = numpy.vstack((self.__buffer_dc, data_dc)) |
|
826 | 826 | |
|
827 | 827 | self.__profIndex += 1 |
|
828 | 828 | return |
|
829 | 829 | |
|
830 | 830 | #If the buffer length is equal to n then replacing the last buffer value with the data value |
|
831 | 831 | self.__buffer_spc = numpy.roll(self.__buffer_spc, -1, axis=0) |
|
832 | 832 | self.__buffer_spc[self.n-1] = data_spc |
|
833 | 833 | |
|
834 | 834 | if data_cspc != None: |
|
835 | 835 | self.__buffer_cspc = numpy.roll(self.__buffer_cspc, -1, axis=0) |
|
836 | 836 | self.__buffer_cspc[self.n-1] = data_cspc |
|
837 | 837 | |
|
838 | 838 | if data_dc != None: |
|
839 | 839 | self.__buffer_dc = numpy.roll(self.__buffer_dc, -1, axis=0) |
|
840 | 840 | self.__buffer_dc[self.n-1] = data_dc |
|
841 | 841 | |
|
842 | 842 | self.__profIndex = self.n |
|
843 | 843 | return |
|
844 | 844 | |
|
845 | 845 | |
|
846 | 846 | def pushData(self): |
|
847 | 847 | """ |
|
848 | 848 | Return the sum of the last profiles and the profiles used in the sum. |
|
849 | 849 | |
|
850 | 850 | Affected: |
|
851 | 851 | |
|
852 | 852 | self.__profileIndex |
|
853 | 853 | |
|
854 | 854 | """ |
|
855 | 855 | data_spc = None |
|
856 | 856 | data_cspc = None |
|
857 | 857 | data_dc = None |
|
858 | 858 | |
|
859 | 859 | if not self.__withOverapping: |
|
860 | 860 | data_spc = self.__buffer_spc |
|
861 | 861 | data_cspc = self.__buffer_cspc |
|
862 | 862 | data_dc = self.__buffer_dc |
|
863 | 863 | |
|
864 | 864 | n = self.__profIndex |
|
865 | 865 | |
|
866 | 866 | self.__buffer_spc = 0 |
|
867 | 867 | self.__buffer_cspc = 0 |
|
868 | 868 | self.__buffer_dc = 0 |
|
869 | 869 | self.__profIndex = 0 |
|
870 | 870 | |
|
871 | 871 | return data_spc, data_cspc, data_dc, n |
|
872 | 872 | |
|
873 | 873 | #Integration with Overlapping |
|
874 | 874 | data_spc = numpy.sum(self.__buffer_spc, axis=0) |
|
875 | 875 | |
|
876 | 876 | if self.__buffer_cspc != None: |
|
877 | 877 | data_cspc = numpy.sum(self.__buffer_cspc, axis=0) |
|
878 | 878 | |
|
879 | 879 | if self.__buffer_dc != None: |
|
880 | 880 | data_dc = numpy.sum(self.__buffer_dc, axis=0) |
|
881 | 881 | |
|
882 | 882 | n = self.__profIndex |
|
883 | 883 | |
|
884 | 884 | return data_spc, data_cspc, data_dc, n |
|
885 | 885 | |
|
886 | 886 | def byProfiles(self, *args): |
|
887 | 887 | |
|
888 | 888 | self.__dataReady = False |
|
889 | 889 | avgdata_spc = None |
|
890 | 890 | avgdata_cspc = None |
|
891 | 891 | avgdata_dc = None |
|
892 | 892 | # n = None |
|
893 | 893 | |
|
894 | 894 | self.putData(*args) |
|
895 | 895 | |
|
896 | 896 | if self.__profIndex == self.n: |
|
897 | 897 | |
|
898 | 898 | avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData() |
|
899 | 899 | self.__dataReady = True |
|
900 | 900 | |
|
901 | 901 | return avgdata_spc, avgdata_cspc, avgdata_dc |
|
902 | 902 | |
|
903 | 903 | def byTime(self, datatime, *args): |
|
904 | 904 | |
|
905 | 905 | self.__dataReady = False |
|
906 | 906 | avgdata_spc = None |
|
907 | 907 | avgdata_cspc = None |
|
908 | 908 | avgdata_dc = None |
|
909 | 909 | n = None |
|
910 | 910 | |
|
911 | 911 | self.putData(*args) |
|
912 | 912 | |
|
913 | 913 | if (datatime - self.__initime) >= self.__integrationtime: |
|
914 | 914 | avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData() |
|
915 | 915 | self.n = n |
|
916 | 916 | self.__dataReady = True |
|
917 | 917 | |
|
918 | 918 | return avgdata_spc, avgdata_cspc, avgdata_dc |
|
919 | 919 | |
|
920 | 920 | def integrate(self, datatime, *args): |
|
921 | 921 | |
|
922 | 922 | if self.__initime == None: |
|
923 | 923 | self.__initime = datatime |
|
924 | 924 | |
|
925 | 925 | if self.__byTime: |
|
926 | 926 | avgdata_spc, avgdata_cspc, avgdata_dc = self.byTime(datatime, *args) |
|
927 | 927 | else: |
|
928 | 928 | avgdata_spc, avgdata_cspc, avgdata_dc = self.byProfiles(*args) |
|
929 | 929 | |
|
930 | 930 | self.__lastdatatime = datatime |
|
931 | 931 | |
|
932 | 932 | if avgdata_spc == None: |
|
933 | 933 | return None, None, None, None |
|
934 | 934 | |
|
935 | 935 | avgdatatime = self.__initime |
|
936 | 936 | try: |
|
937 | 937 | self.__timeInterval = (self.__lastdatatime - self.__initime)/(self.n - 1) |
|
938 | 938 | except: |
|
939 | 939 | self.__timeInterval = self.__lastdatatime - self.__initime |
|
940 | 940 | |
|
941 | 941 | deltatime = datatime -self.__lastdatatime |
|
942 | 942 | |
|
943 | 943 | if not self.__withOverapping: |
|
944 | 944 | self.__initime = datatime |
|
945 | 945 | else: |
|
946 | 946 | self.__initime += deltatime |
|
947 | 947 | |
|
948 | 948 | return avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc |
|
949 | 949 | |
|
950 | 950 | def run(self, dataOut, n=None, timeInterval=None, overlapping=False): |
|
951 | 951 | |
|
952 | 952 | if n==1: |
|
953 | 953 | dataOut.flagNoData = False |
|
954 | 954 | return |
|
955 | 955 | |
|
956 | 956 | if not self.isConfig: |
|
957 | 957 | self.setup(n, timeInterval, overlapping) |
|
958 | 958 | self.isConfig = True |
|
959 | 959 | |
|
960 | 960 | avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc = self.integrate(dataOut.utctime, |
|
961 | 961 | dataOut.data_spc, |
|
962 | 962 | dataOut.data_cspc, |
|
963 | 963 | dataOut.data_dc) |
|
964 | 964 | |
|
965 | 965 | # dataOut.timeInterval *= n |
|
966 | 966 | dataOut.flagNoData = True |
|
967 | 967 | |
|
968 | 968 | if self.__dataReady: |
|
969 | 969 | |
|
970 | 970 | dataOut.data_spc = avgdata_spc |
|
971 | 971 | dataOut.data_cspc = avgdata_cspc |
|
972 | 972 | dataOut.data_dc = avgdata_dc |
|
973 | 973 | |
|
974 | 974 | dataOut.nIncohInt *= self.n |
|
975 | 975 | dataOut.utctime = avgdatatime |
|
976 | 976 | #dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt * dataOut.nIncohInt * dataOut.nFFTPoints |
|
977 | 977 | # dataOut.timeInterval = self.__timeInterval*self.n |
|
978 | 978 | dataOut.flagNoData = False |
@@ -1,1051 +1,1055 | |||
|
1 | 1 | import numpy |
|
2 | 2 | |
|
3 | 3 | from jroproc_base import ProcessingUnit, Operation |
|
4 | 4 | from schainpy.model.data.jrodata import Voltage |
|
5 | 5 | |
|
6 | 6 | class VoltageProc(ProcessingUnit): |
|
7 | 7 | |
|
8 | 8 | |
|
9 | 9 | def __init__(self): |
|
10 | 10 | |
|
11 | 11 | ProcessingUnit.__init__(self) |
|
12 | 12 | |
|
13 | 13 | # self.objectDict = {} |
|
14 | 14 | self.dataOut = Voltage() |
|
15 | 15 | self.flip = 1 |
|
16 | 16 | |
|
17 | 17 | def run(self): |
|
18 | 18 | if self.dataIn.type == 'AMISR': |
|
19 | 19 | self.__updateObjFromAmisrInput() |
|
20 | 20 | |
|
21 | 21 | if self.dataIn.type == 'Voltage': |
|
22 | 22 | self.dataOut.copy(self.dataIn) |
|
23 | 23 | |
|
24 | 24 | # self.dataOut.copy(self.dataIn) |
|
25 | 25 | |
|
26 | 26 | def __updateObjFromAmisrInput(self): |
|
27 | 27 | |
|
28 | 28 | self.dataOut.timeZone = self.dataIn.timeZone |
|
29 | 29 | self.dataOut.dstFlag = self.dataIn.dstFlag |
|
30 | 30 | self.dataOut.errorCount = self.dataIn.errorCount |
|
31 | 31 | self.dataOut.useLocalTime = self.dataIn.useLocalTime |
|
32 | 32 | |
|
33 | 33 | self.dataOut.flagNoData = self.dataIn.flagNoData |
|
34 | 34 | self.dataOut.data = self.dataIn.data |
|
35 | 35 | self.dataOut.utctime = self.dataIn.utctime |
|
36 | 36 | self.dataOut.channelList = self.dataIn.channelList |
|
37 | 37 | # self.dataOut.timeInterval = self.dataIn.timeInterval |
|
38 | 38 | self.dataOut.heightList = self.dataIn.heightList |
|
39 | 39 | self.dataOut.nProfiles = self.dataIn.nProfiles |
|
40 | 40 | |
|
41 | 41 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
42 | 42 | self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
43 | 43 | self.dataOut.frequency = self.dataIn.frequency |
|
44 | 44 | |
|
45 | 45 | self.dataOut.azimuth = self.dataIn.azimuth |
|
46 | 46 | self.dataOut.zenith = self.dataIn.zenith |
|
47 | 47 | |
|
48 | 48 | self.dataOut.beam.codeList = self.dataIn.beam.codeList |
|
49 | 49 | self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList |
|
50 | 50 | self.dataOut.beam.zenithList = self.dataIn.beam.zenithList |
|
51 | 51 | # |
|
52 | 52 | # pass# |
|
53 | 53 | # |
|
54 | 54 | # def init(self): |
|
55 | 55 | # |
|
56 | 56 | # |
|
57 | 57 | # if self.dataIn.type == 'AMISR': |
|
58 | 58 | # self.__updateObjFromAmisrInput() |
|
59 | 59 | # |
|
60 | 60 | # if self.dataIn.type == 'Voltage': |
|
61 | 61 | # self.dataOut.copy(self.dataIn) |
|
62 | 62 | # # No necesita copiar en cada init() los atributos de dataIn |
|
63 | 63 | # # la copia deberia hacerse por cada nuevo bloque de datos |
|
64 | 64 | |
|
65 | 65 | def selectChannels(self, channelList): |
|
66 | 66 | |
|
67 | 67 | channelIndexList = [] |
|
68 | 68 | |
|
69 | 69 | for channel in channelList: |
|
70 | 70 | if channel not in self.dataOut.channelList: |
|
71 | 71 | raise ValueError, "Channel %d is not in %s" %(channel, str(self.dataOut.channelList)) |
|
72 | 72 | |
|
73 | 73 | index = self.dataOut.channelList.index(channel) |
|
74 | 74 | channelIndexList.append(index) |
|
75 | 75 | |
|
76 | 76 | self.selectChannelsByIndex(channelIndexList) |
|
77 | 77 | |
|
78 | 78 | def selectChannelsByIndex(self, channelIndexList): |
|
79 | 79 | """ |
|
80 | 80 | Selecciona un bloque de datos en base a canales segun el channelIndexList |
|
81 | 81 | |
|
82 | 82 | Input: |
|
83 | 83 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] |
|
84 | 84 | |
|
85 | 85 | Affected: |
|
86 | 86 | self.dataOut.data |
|
87 | 87 | self.dataOut.channelIndexList |
|
88 | 88 | self.dataOut.nChannels |
|
89 | 89 | self.dataOut.m_ProcessingHeader.totalSpectra |
|
90 | 90 | self.dataOut.systemHeaderObj.numChannels |
|
91 | 91 | self.dataOut.m_ProcessingHeader.blockSize |
|
92 | 92 | |
|
93 | 93 | Return: |
|
94 | 94 | None |
|
95 | 95 | """ |
|
96 | 96 | |
|
97 | 97 | for channelIndex in channelIndexList: |
|
98 | 98 | if channelIndex not in self.dataOut.channelIndexList: |
|
99 | 99 | print channelIndexList |
|
100 | 100 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex |
|
101 | 101 | |
|
102 | 102 | # nChannels = len(channelIndexList) |
|
103 | 103 | if self.dataOut.flagDataAsBlock: |
|
104 | 104 | """ |
|
105 | 105 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] |
|
106 | 106 | """ |
|
107 | 107 | data = self.dataOut.data[channelIndexList,:,:] |
|
108 | 108 | else: |
|
109 | 109 | data = self.dataOut.data[channelIndexList,:] |
|
110 | 110 | |
|
111 | 111 | self.dataOut.data = data |
|
112 | 112 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
113 | 113 | # self.dataOut.nChannels = nChannels |
|
114 | 114 | |
|
115 | 115 | return 1 |
|
116 | 116 | |
|
117 | 117 | def selectHeights(self, minHei=None, maxHei=None): |
|
118 | 118 | """ |
|
119 | 119 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango |
|
120 | 120 | minHei <= height <= maxHei |
|
121 | 121 | |
|
122 | 122 | Input: |
|
123 | 123 | minHei : valor minimo de altura a considerar |
|
124 | 124 | maxHei : valor maximo de altura a considerar |
|
125 | 125 | |
|
126 | 126 | Affected: |
|
127 | 127 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex |
|
128 | 128 | |
|
129 | 129 | Return: |
|
130 | 130 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
131 | 131 | """ |
|
132 | 132 | |
|
133 | 133 | if minHei == None: |
|
134 | 134 | minHei = self.dataOut.heightList[0] |
|
135 | 135 | |
|
136 | 136 | if maxHei == None: |
|
137 | 137 | maxHei = self.dataOut.heightList[-1] |
|
138 | 138 | |
|
139 | 139 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): |
|
140 | 140 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
141 | 141 | |
|
142 | 142 | |
|
143 | 143 | if (maxHei > self.dataOut.heightList[-1]): |
|
144 | 144 | maxHei = self.dataOut.heightList[-1] |
|
145 | 145 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
146 | 146 | |
|
147 | 147 | minIndex = 0 |
|
148 | 148 | maxIndex = 0 |
|
149 | 149 | heights = self.dataOut.heightList |
|
150 | 150 | |
|
151 | 151 | inda = numpy.where(heights >= minHei) |
|
152 | 152 | indb = numpy.where(heights <= maxHei) |
|
153 | 153 | |
|
154 | 154 | try: |
|
155 | 155 | minIndex = inda[0][0] |
|
156 | 156 | except: |
|
157 | 157 | minIndex = 0 |
|
158 | 158 | |
|
159 | 159 | try: |
|
160 | 160 | maxIndex = indb[0][-1] |
|
161 | 161 | except: |
|
162 | 162 | maxIndex = len(heights) |
|
163 | 163 | |
|
164 | 164 | self.selectHeightsByIndex(minIndex, maxIndex) |
|
165 | 165 | |
|
166 | 166 | return 1 |
|
167 | 167 | |
|
168 | 168 | |
|
169 | 169 | def selectHeightsByIndex(self, minIndex, maxIndex): |
|
170 | 170 | """ |
|
171 | 171 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango |
|
172 | 172 | minIndex <= index <= maxIndex |
|
173 | 173 | |
|
174 | 174 | Input: |
|
175 | 175 | minIndex : valor de indice minimo de altura a considerar |
|
176 | 176 | maxIndex : valor de indice maximo de altura a considerar |
|
177 | 177 | |
|
178 | 178 | Affected: |
|
179 | 179 | self.dataOut.data |
|
180 | 180 | self.dataOut.heightList |
|
181 | 181 | |
|
182 | 182 | Return: |
|
183 | 183 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
184 | 184 | """ |
|
185 | 185 | |
|
186 | 186 | if (minIndex < 0) or (minIndex > maxIndex): |
|
187 | 187 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
188 | 188 | |
|
189 | 189 | if (maxIndex >= self.dataOut.nHeights): |
|
190 | 190 | maxIndex = self.dataOut.nHeights |
|
191 | 191 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
192 | 192 | |
|
193 | 193 | # nHeights = maxIndex - minIndex + 1 |
|
194 | 194 | |
|
195 | 195 | #voltage |
|
196 | 196 | if self.dataOut.flagDataAsBlock: |
|
197 | 197 | """ |
|
198 | 198 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] |
|
199 | 199 | """ |
|
200 | 200 | data = self.dataOut.data[:,minIndex:maxIndex,:] |
|
201 | 201 | else: |
|
202 | 202 | data = self.dataOut.data[:,minIndex:maxIndex] |
|
203 | 203 | |
|
204 | 204 | # firstHeight = self.dataOut.heightList[minIndex] |
|
205 | 205 | |
|
206 | 206 | self.dataOut.data = data |
|
207 | 207 | self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex] |
|
208 | 208 | |
|
209 | 209 | if self.dataOut.nHeights <= 1: |
|
210 | 210 | raise ValueError, "selectHeights: Too few heights. Current number of heights is %d" %(self.dataOut.nHeights) |
|
211 | 211 | |
|
212 | 212 | return 1 |
|
213 | 213 | |
|
214 | 214 | |
|
215 | 215 | def filterByHeights(self, window): |
|
216 | 216 | |
|
217 | 217 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
218 | 218 | |
|
219 | 219 | if window == None: |
|
220 | 220 | window = (self.dataOut.radarControllerHeaderObj.txA/self.dataOut.radarControllerHeaderObj.nBaud) / deltaHeight |
|
221 | 221 | |
|
222 | 222 | newdelta = deltaHeight * window |
|
223 | 223 | r = self.dataOut.nHeights % window |
|
224 | 224 | newheights = (self.dataOut.nHeights-r)/window |
|
225 | 225 | |
|
226 | 226 | if newheights <= 1: |
|
227 | 227 | raise ValueError, "filterByHeights: Too few heights. Current number of heights is %d and window is %d" %(self.dataOut.nHeights, window) |
|
228 | 228 | |
|
229 | 229 | if self.dataOut.flagDataAsBlock: |
|
230 | 230 | """ |
|
231 | 231 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] |
|
232 | 232 | """ |
|
233 | 233 | buffer = self.dataOut.data[:, :, 0:self.dataOut.nHeights-r] |
|
234 | 234 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nProfiles,self.dataOut.nHeights/window,window) |
|
235 | 235 | buffer = numpy.sum(buffer,3) |
|
236 | 236 | |
|
237 | 237 | else: |
|
238 | 238 | buffer = self.dataOut.data[:,0:self.dataOut.nHeights-r] |
|
239 | 239 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nHeights/window,window) |
|
240 | 240 | buffer = numpy.sum(buffer,2) |
|
241 | 241 | |
|
242 | 242 | self.dataOut.data = buffer |
|
243 | 243 | self.dataOut.heightList = self.dataOut.heightList[0] + numpy.arange( newheights )*newdelta |
|
244 | 244 | self.dataOut.windowOfFilter = window |
|
245 | 245 | |
|
246 | 246 | def setH0(self, h0, deltaHeight = None): |
|
247 | 247 | |
|
248 | 248 | if not deltaHeight: |
|
249 | 249 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
250 | 250 | |
|
251 | 251 | nHeights = self.dataOut.nHeights |
|
252 | 252 | |
|
253 | 253 | newHeiRange = h0 + numpy.arange(nHeights)*deltaHeight |
|
254 | 254 | |
|
255 | 255 | self.dataOut.heightList = newHeiRange |
|
256 | 256 | |
|
257 | 257 | def deFlip(self, channelList = []): |
|
258 | 258 | |
|
259 | 259 | data = self.dataOut.data.copy() |
|
260 | 260 | |
|
261 | 261 | if self.dataOut.flagDataAsBlock: |
|
262 | 262 | flip = self.flip |
|
263 | 263 | profileList = range(self.dataOut.nProfiles) |
|
264 | 264 | |
|
265 | 265 | if not channelList: |
|
266 | 266 | for thisProfile in profileList: |
|
267 | 267 | data[:,thisProfile,:] = data[:,thisProfile,:]*flip |
|
268 | 268 | flip *= -1.0 |
|
269 | 269 | else: |
|
270 | 270 | for thisChannel in channelList: |
|
271 | 271 | if thisChannel not in self.dataOut.channelList: |
|
272 | 272 | continue |
|
273 | 273 | |
|
274 | 274 | for thisProfile in profileList: |
|
275 | 275 | data[thisChannel,thisProfile,:] = data[thisChannel,thisProfile,:]*flip |
|
276 | 276 | flip *= -1.0 |
|
277 | 277 | |
|
278 | 278 | self.flip = flip |
|
279 | 279 | |
|
280 | 280 | else: |
|
281 | 281 | if not channelList: |
|
282 | 282 | data[:,:] = data[:,:]*self.flip |
|
283 | 283 | else: |
|
284 | 284 | for thisChannel in channelList: |
|
285 | 285 | if thisChannel not in self.dataOut.channelList: |
|
286 | 286 | continue |
|
287 | 287 | |
|
288 | 288 | data[thisChannel,:] = data[thisChannel,:]*self.flip |
|
289 | 289 | |
|
290 | 290 | self.flip *= -1. |
|
291 | 291 | |
|
292 | 292 | self.dataOut.data = data |
|
293 | 293 | |
|
294 | 294 | def setRadarFrequency(self, frequency=None): |
|
295 | 295 | |
|
296 | 296 | if frequency != None: |
|
297 | 297 | self.dataOut.frequency = frequency |
|
298 | 298 | |
|
299 | 299 | return 1 |
|
300 | 300 | |
|
301 | 301 | class CohInt(Operation): |
|
302 | 302 | |
|
303 | 303 | isConfig = False |
|
304 | 304 | |
|
305 | 305 | __profIndex = 0 |
|
306 | 306 | __withOverapping = False |
|
307 | 307 | |
|
308 | 308 | __byTime = False |
|
309 | 309 | __initime = None |
|
310 | 310 | __lastdatatime = None |
|
311 | 311 | __integrationtime = None |
|
312 | 312 | |
|
313 | 313 | __buffer = None |
|
314 | 314 | |
|
315 | 315 | __dataReady = False |
|
316 | 316 | |
|
317 | 317 | n = None |
|
318 | 318 | |
|
319 | 319 | |
|
320 | 320 | def __init__(self): |
|
321 | 321 | |
|
322 | 322 | Operation.__init__(self) |
|
323 | 323 | |
|
324 | 324 | # self.isConfig = False |
|
325 | 325 | |
|
326 | 326 | def setup(self, n=None, timeInterval=None, overlapping=False, byblock=False): |
|
327 | 327 | """ |
|
328 | 328 | Set the parameters of the integration class. |
|
329 | 329 | |
|
330 | 330 | Inputs: |
|
331 | 331 | |
|
332 | 332 | n : Number of coherent integrations |
|
333 | 333 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work |
|
334 | 334 | overlapping : |
|
335 | 335 | |
|
336 | 336 | """ |
|
337 | 337 | |
|
338 | 338 | self.__initime = None |
|
339 | 339 | self.__lastdatatime = 0 |
|
340 | 340 | self.__buffer = None |
|
341 | 341 | self.__dataReady = False |
|
342 | 342 | self.byblock = byblock |
|
343 | 343 | |
|
344 | 344 | if n == None and timeInterval == None: |
|
345 | 345 | raise ValueError, "n or timeInterval should be specified ..." |
|
346 | 346 | |
|
347 | 347 | if n != None: |
|
348 | 348 | self.n = n |
|
349 | 349 | self.__byTime = False |
|
350 | 350 | else: |
|
351 | 351 | self.__integrationtime = timeInterval #* 60. #if (type(timeInterval)!=integer) -> change this line |
|
352 | 352 | self.n = 9999 |
|
353 | 353 | self.__byTime = True |
|
354 | 354 | |
|
355 | 355 | if overlapping: |
|
356 | 356 | self.__withOverapping = True |
|
357 | 357 | self.__buffer = None |
|
358 | 358 | else: |
|
359 | 359 | self.__withOverapping = False |
|
360 | 360 | self.__buffer = 0 |
|
361 | 361 | |
|
362 | 362 | self.__profIndex = 0 |
|
363 | 363 | |
|
364 | 364 | def putData(self, data): |
|
365 | 365 | |
|
366 | 366 | """ |
|
367 | 367 | Add a profile to the __buffer and increase in one the __profileIndex |
|
368 | 368 | |
|
369 | 369 | """ |
|
370 | 370 | |
|
371 | 371 | if not self.__withOverapping: |
|
372 | 372 | self.__buffer += data.copy() |
|
373 | 373 | self.__profIndex += 1 |
|
374 | 374 | return |
|
375 | 375 | |
|
376 | 376 | #Overlapping data |
|
377 | 377 | nChannels, nHeis = data.shape |
|
378 | 378 | data = numpy.reshape(data, (1, nChannels, nHeis)) |
|
379 | 379 | |
|
380 | 380 | #If the buffer is empty then it takes the data value |
|
381 | 381 | if self.__buffer == None: |
|
382 | 382 | self.__buffer = data |
|
383 | 383 | self.__profIndex += 1 |
|
384 | 384 | return |
|
385 | 385 | |
|
386 | 386 | #If the buffer length is lower than n then stakcing the data value |
|
387 | 387 | if self.__profIndex < self.n: |
|
388 | 388 | self.__buffer = numpy.vstack((self.__buffer, data)) |
|
389 | 389 | self.__profIndex += 1 |
|
390 | 390 | return |
|
391 | 391 | |
|
392 | 392 | #If the buffer length is equal to n then replacing the last buffer value with the data value |
|
393 | 393 | self.__buffer = numpy.roll(self.__buffer, -1, axis=0) |
|
394 | 394 | self.__buffer[self.n-1] = data |
|
395 | 395 | self.__profIndex = self.n |
|
396 | 396 | return |
|
397 | 397 | |
|
398 | 398 | |
|
399 | 399 | def pushData(self): |
|
400 | 400 | """ |
|
401 | 401 | Return the sum of the last profiles and the profiles used in the sum. |
|
402 | 402 | |
|
403 | 403 | Affected: |
|
404 | 404 | |
|
405 | 405 | self.__profileIndex |
|
406 | 406 | |
|
407 | 407 | """ |
|
408 | 408 | |
|
409 | 409 | if not self.__withOverapping: |
|
410 | 410 | data = self.__buffer |
|
411 | 411 | n = self.__profIndex |
|
412 | 412 | |
|
413 | 413 | self.__buffer = 0 |
|
414 | 414 | self.__profIndex = 0 |
|
415 | 415 | |
|
416 | 416 | return data, n |
|
417 | 417 | |
|
418 | 418 | #Integration with Overlapping |
|
419 | 419 | data = numpy.sum(self.__buffer, axis=0) |
|
420 | 420 | n = self.__profIndex |
|
421 | 421 | |
|
422 | 422 | return data, n |
|
423 | 423 | |
|
424 | 424 | def byProfiles(self, data): |
|
425 | 425 | |
|
426 | 426 | self.__dataReady = False |
|
427 | 427 | avgdata = None |
|
428 | 428 | # n = None |
|
429 | 429 | |
|
430 | 430 | self.putData(data) |
|
431 | 431 | |
|
432 | 432 | if self.__profIndex == self.n: |
|
433 | 433 | |
|
434 | 434 | avgdata, n = self.pushData() |
|
435 | 435 | self.__dataReady = True |
|
436 | 436 | |
|
437 | 437 | return avgdata |
|
438 | 438 | |
|
439 | 439 | def byTime(self, data, datatime): |
|
440 | 440 | |
|
441 | 441 | self.__dataReady = False |
|
442 | 442 | avgdata = None |
|
443 | 443 | n = None |
|
444 | 444 | |
|
445 | 445 | self.putData(data) |
|
446 | 446 | |
|
447 | 447 | if (datatime - self.__initime) >= self.__integrationtime: |
|
448 | 448 | avgdata, n = self.pushData() |
|
449 | 449 | self.n = n |
|
450 | 450 | self.__dataReady = True |
|
451 | 451 | |
|
452 | 452 | return avgdata |
|
453 | 453 | |
|
454 | 454 | def integrate(self, data, datatime=None): |
|
455 | 455 | |
|
456 | 456 | if self.__initime == None: |
|
457 | 457 | self.__initime = datatime |
|
458 | 458 | |
|
459 | 459 | if self.__byTime: |
|
460 | 460 | avgdata = self.byTime(data, datatime) |
|
461 | 461 | else: |
|
462 | 462 | avgdata = self.byProfiles(data) |
|
463 | 463 | |
|
464 | 464 | |
|
465 | 465 | self.__lastdatatime = datatime |
|
466 | 466 | |
|
467 | 467 | if avgdata == None: |
|
468 | 468 | return None, None |
|
469 | 469 | |
|
470 | 470 | avgdatatime = self.__initime |
|
471 | 471 | |
|
472 | 472 | deltatime = datatime -self.__lastdatatime |
|
473 | 473 | |
|
474 | 474 | if not self.__withOverapping: |
|
475 | 475 | self.__initime = datatime |
|
476 | 476 | else: |
|
477 | 477 | self.__initime += deltatime |
|
478 | 478 | |
|
479 | 479 | return avgdata, avgdatatime |
|
480 | 480 | |
|
481 | 481 | def integrateByBlock(self, dataOut): |
|
482 | 482 | |
|
483 | 483 | times = int(dataOut.data.shape[1]/self.n) |
|
484 | 484 | avgdata = numpy.zeros((dataOut.nChannels, times, dataOut.nHeights), dtype=numpy.complex) |
|
485 | 485 | |
|
486 | 486 | id_min = 0 |
|
487 | 487 | id_max = self.n |
|
488 | 488 | |
|
489 | 489 | for i in range(times): |
|
490 | 490 | junk = dataOut.data[:,id_min:id_max,:] |
|
491 | 491 | avgdata[:,i,:] = junk.sum(axis=1) |
|
492 | 492 | id_min += self.n |
|
493 | 493 | id_max += self.n |
|
494 | 494 | |
|
495 | 495 | timeInterval = dataOut.ippSeconds*self.n |
|
496 | 496 | avgdatatime = (times - 1) * timeInterval + dataOut.utctime |
|
497 | 497 | self.__dataReady = True |
|
498 | 498 | return avgdata, avgdatatime |
|
499 | 499 | |
|
500 | 500 | def run(self, dataOut, **kwargs): |
|
501 | 501 | |
|
502 | 502 | if not self.isConfig: |
|
503 | 503 | self.setup(**kwargs) |
|
504 | 504 | self.isConfig = True |
|
505 | 505 | |
|
506 | 506 | if dataOut.flagDataAsBlock: |
|
507 | 507 | """ |
|
508 | 508 | Si la data es leida por bloques, dimension = [nChannels, nProfiles, nHeis] |
|
509 | 509 | """ |
|
510 | 510 | avgdata, avgdatatime = self.integrateByBlock(dataOut) |
|
511 | 511 | else: |
|
512 | 512 | avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) |
|
513 | 513 | |
|
514 | 514 | # dataOut.timeInterval *= n |
|
515 | 515 | dataOut.flagNoData = True |
|
516 | 516 | |
|
517 | 517 | if self.__dataReady: |
|
518 | 518 | dataOut.data = avgdata |
|
519 | 519 | dataOut.nCohInt *= self.n |
|
520 | 520 | dataOut.utctime = avgdatatime |
|
521 | 521 | # dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt |
|
522 | 522 | dataOut.flagNoData = False |
|
523 | 523 | |
|
524 | 524 | class Decoder(Operation): |
|
525 | 525 | |
|
526 | 526 | isConfig = False |
|
527 | 527 | __profIndex = 0 |
|
528 | 528 | |
|
529 | 529 | code = None |
|
530 | 530 | |
|
531 | 531 | nCode = None |
|
532 | 532 | nBaud = None |
|
533 | 533 | |
|
534 | 534 | |
|
535 | 535 | def __init__(self): |
|
536 | 536 | |
|
537 | 537 | Operation.__init__(self) |
|
538 | 538 | |
|
539 | 539 | self.times = None |
|
540 | 540 | self.osamp = None |
|
541 | 541 | # self.__setValues = False |
|
542 | 542 | self.isConfig = False |
|
543 | 543 | |
|
544 | 544 | def setup(self, code, osamp, dataOut): |
|
545 | 545 | |
|
546 | 546 | self.__profIndex = 0 |
|
547 | 547 | |
|
548 | 548 | self.code = code |
|
549 | 549 | |
|
550 | 550 | self.nCode = len(code) |
|
551 | 551 | self.nBaud = len(code[0]) |
|
552 | 552 | |
|
553 | 553 | if (osamp != None) and (osamp >1): |
|
554 | 554 | self.osamp = osamp |
|
555 | 555 | self.code = numpy.repeat(code, repeats=self.osamp, axis=1) |
|
556 | 556 | self.nBaud = self.nBaud*self.osamp |
|
557 | 557 | |
|
558 | 558 | self.__nChannels = dataOut.nChannels |
|
559 | 559 | self.__nProfiles = dataOut.nProfiles |
|
560 | 560 | self.__nHeis = dataOut.nHeights |
|
561 | 561 | |
|
562 | 562 | if dataOut.flagDataAsBlock: |
|
563 | 563 | |
|
564 | 564 | self.ndatadec = self.__nHeis #- self.nBaud + 1 |
|
565 | 565 | |
|
566 | 566 | self.datadecTime = numpy.zeros((self.__nChannels, self.__nProfiles, self.ndatadec), dtype=numpy.complex) |
|
567 | 567 | |
|
568 | 568 | else: |
|
569 | 569 | |
|
570 | 570 | __codeBuffer = numpy.zeros((self.nCode, self.__nHeis), dtype=numpy.complex) |
|
571 | 571 | |
|
572 | 572 | __codeBuffer[:,0:self.nBaud] = self.code |
|
573 | 573 | |
|
574 | 574 | self.fft_code = numpy.conj(numpy.fft.fft(__codeBuffer, axis=1)) |
|
575 | 575 | |
|
576 | 576 | self.ndatadec = self.__nHeis #- self.nBaud + 1 |
|
577 | 577 | |
|
578 | 578 | self.datadecTime = numpy.zeros((self.__nChannels, self.ndatadec), dtype=numpy.complex) |
|
579 | 579 | |
|
580 | 580 | def convolutionInFreq(self, data): |
|
581 | 581 | |
|
582 | 582 | fft_code = self.fft_code[self.__profIndex].reshape(1,-1) |
|
583 | 583 | |
|
584 | 584 | fft_data = numpy.fft.fft(data, axis=1) |
|
585 | 585 | |
|
586 | 586 | conv = fft_data*fft_code |
|
587 | 587 | |
|
588 | 588 | data = numpy.fft.ifft(conv,axis=1) |
|
589 | 589 | |
|
590 | 590 | datadec = data#[:,:] |
|
591 | 591 | |
|
592 | 592 | return datadec |
|
593 | 593 | |
|
594 | 594 | def convolutionInFreqOpt(self, data): |
|
595 | 595 | |
|
596 | 596 | raise NotImplementedError |
|
597 | 597 | |
|
598 | 598 | # fft_code = self.fft_code[self.__profIndex].reshape(1,-1) |
|
599 | 599 | # |
|
600 | 600 | # data = cfunctions.decoder(fft_code, data) |
|
601 | 601 | # |
|
602 | 602 | # datadec = data#[:,:] |
|
603 | 603 | # |
|
604 | 604 | # return datadec |
|
605 | 605 | |
|
606 | 606 | def convolutionInTime(self, data): |
|
607 | 607 | |
|
608 | 608 | code = self.code[self.__profIndex] |
|
609 | 609 | |
|
610 | 610 | for i in range(self.__nChannels): |
|
611 | 611 | self.datadecTime[i,:] = numpy.correlate(data[i,:], code, mode='same') |
|
612 | 612 | |
|
613 | 613 | return self.datadecTime |
|
614 | 614 | |
|
615 | 615 | def convolutionByBlockInTime(self, data): |
|
616 | 616 | |
|
617 | 617 | repetitions = self.__nProfiles / self.nCode |
|
618 | 618 | |
|
619 | 619 | junk = numpy.lib.stride_tricks.as_strided(self.code, (repetitions, self.code.size), (0, self.code.itemsize)) |
|
620 | 620 | junk = junk.flatten() |
|
621 | 621 | code_block = numpy.reshape(junk, (self.nCode*repetitions, self.nBaud)) |
|
622 | 622 | |
|
623 | 623 | for i in range(self.__nChannels): |
|
624 | 624 | for j in range(self.__nProfiles): |
|
625 | 625 | self.datadecTime[i,j,:] = numpy.correlate(data[i,j,:], code_block[j,:], mode='same') |
|
626 | 626 | |
|
627 | 627 | return self.datadecTime |
|
628 | 628 | |
|
629 | 629 | def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0, osamp=None): |
|
630 | 630 | |
|
631 | 631 | if not self.isConfig: |
|
632 | 632 | |
|
633 | 633 | if code == None: |
|
634 | 634 | code = dataOut.code |
|
635 | 635 | else: |
|
636 | 636 | code = numpy.array(code).reshape(nCode,nBaud) |
|
637 | 637 | |
|
638 | 638 | self.setup(code, osamp, dataOut) |
|
639 | 639 | |
|
640 | 640 | self.isConfig = True |
|
641 | 641 | |
|
642 | 642 | if dataOut.flagDataAsBlock: |
|
643 | 643 | """ |
|
644 | 644 | Decoding when data have been read as block, |
|
645 | 645 | """ |
|
646 | 646 | datadec = self.convolutionByBlockInTime(dataOut.data) |
|
647 | 647 | |
|
648 | 648 | else: |
|
649 | 649 | """ |
|
650 | 650 | Decoding when data have been read profile by profile |
|
651 | 651 | """ |
|
652 | 652 | if mode == 0: |
|
653 | 653 | datadec = self.convolutionInTime(dataOut.data) |
|
654 | 654 | |
|
655 | 655 | if mode == 1: |
|
656 | 656 | datadec = self.convolutionInFreq(dataOut.data) |
|
657 | 657 | |
|
658 | 658 | if mode == 2: |
|
659 | 659 | datadec = self.convolutionInFreqOpt(dataOut.data) |
|
660 | 660 | |
|
661 | 661 | dataOut.code = self.code |
|
662 | 662 | dataOut.nCode = self.nCode |
|
663 | 663 | dataOut.nBaud = self.nBaud |
|
664 | 664 | |
|
665 | 665 | dataOut.data = datadec |
|
666 | 666 | |
|
667 | 667 | dataOut.heightList = dataOut.heightList[0:self.ndatadec] |
|
668 | 668 | |
|
669 | 669 | dataOut.flagDecodeData = True #asumo q la data esta decodificada |
|
670 | 670 | |
|
671 | 671 | if self.__profIndex == self.nCode-1: |
|
672 | 672 | self.__profIndex = 0 |
|
673 | 673 | return 1 |
|
674 | 674 | |
|
675 | 675 | self.__profIndex += 1 |
|
676 | 676 | |
|
677 | 677 | return 1 |
|
678 | 678 | # dataOut.flagDeflipData = True #asumo q la data no esta sin flip |
|
679 | 679 | |
|
680 | 680 | |
|
681 | 681 | class ProfileConcat(Operation): |
|
682 | 682 | |
|
683 | 683 | isConfig = False |
|
684 | 684 | buffer = None |
|
685 | 685 | |
|
686 | 686 | def __init__(self): |
|
687 | 687 | |
|
688 | 688 | Operation.__init__(self) |
|
689 | 689 | self.profileIndex = 0 |
|
690 | 690 | |
|
691 | 691 | def reset(self): |
|
692 | 692 | self.buffer = numpy.zeros_like(self.buffer) |
|
693 | 693 | self.start_index = 0 |
|
694 | 694 | self.times = 1 |
|
695 | 695 | |
|
696 | 696 | def setup(self, data, m, n=1): |
|
697 | 697 | self.buffer = numpy.zeros((data.shape[0],data.shape[1]*m),dtype=type(data[0,0])) |
|
698 | 698 | self.nHeights = data.nHeights |
|
699 | 699 | self.start_index = 0 |
|
700 | 700 | self.times = 1 |
|
701 | 701 | |
|
702 | 702 | def concat(self, data): |
|
703 | 703 | |
|
704 | 704 | self.buffer[:,self.start_index:self.profiles*self.times] = data.copy() |
|
705 | 705 | self.start_index = self.start_index + self.nHeights |
|
706 | 706 | |
|
707 | 707 | def run(self, dataOut, m): |
|
708 | 708 | |
|
709 | 709 | dataOut.flagNoData = True |
|
710 | 710 | |
|
711 | 711 | if not self.isConfig: |
|
712 | 712 | self.setup(dataOut.data, m, 1) |
|
713 | 713 | self.isConfig = True |
|
714 | 714 | |
|
715 | 715 | if dataOut.flagDataAsBlock: |
|
716 | 716 | |
|
717 | 717 | raise ValueError, "ProfileConcat can only be used when voltage have been read profile by profile, getBlock = False" |
|
718 | 718 | |
|
719 | 719 | else: |
|
720 | 720 | self.concat(dataOut.data) |
|
721 | 721 | self.times += 1 |
|
722 | 722 | if self.times > m: |
|
723 | 723 | dataOut.data = self.buffer |
|
724 | 724 | self.reset() |
|
725 | 725 | dataOut.flagNoData = False |
|
726 | 726 | # se deben actualizar mas propiedades del header y del objeto dataOut, por ejemplo, las alturas |
|
727 | 727 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] |
|
728 | 728 | xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * m |
|
729 | 729 | dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight) |
|
730 | 730 | dataOut.ippSeconds *= m |
|
731 | 731 | |
|
732 | 732 | class ProfileSelector(Operation): |
|
733 | 733 | |
|
734 | 734 | profileIndex = None |
|
735 | 735 | # Tamanho total de los perfiles |
|
736 | 736 | nProfiles = None |
|
737 | 737 | |
|
738 | 738 | def __init__(self): |
|
739 | 739 | |
|
740 | 740 | Operation.__init__(self) |
|
741 | 741 | self.profileIndex = 0 |
|
742 | 742 | |
|
743 | 743 | def incIndex(self): |
|
744 | 744 | |
|
745 | 745 | self.profileIndex += 1 |
|
746 | 746 | |
|
747 | 747 | if self.profileIndex >= self.nProfiles: |
|
748 | 748 | self.profileIndex = 0 |
|
749 | 749 | |
|
750 | 750 | def isThisProfileInRange(self, profileIndex, minIndex, maxIndex): |
|
751 | 751 | |
|
752 | 752 | if profileIndex < minIndex: |
|
753 | 753 | return False |
|
754 | 754 | |
|
755 | 755 | if profileIndex > maxIndex: |
|
756 | 756 | return False |
|
757 | 757 | |
|
758 | 758 | return True |
|
759 | 759 | |
|
760 | 760 | def isThisProfileInList(self, profileIndex, profileList): |
|
761 | 761 | |
|
762 | 762 | if profileIndex not in profileList: |
|
763 | 763 | return False |
|
764 | 764 | |
|
765 | 765 | return True |
|
766 | 766 | |
|
767 | def run(self, dataOut, profileList=None, profileRangeList=None, beam=None, byblock=False, rangeList = None): | |
|
767 | def run(self, dataOut, profileList=None, profileRangeList=None, beam=None, byblock=False, rangeList = None, nProfiles=None): | |
|
768 | 768 | |
|
769 | 769 | """ |
|
770 | 770 | ProfileSelector: |
|
771 | 771 | |
|
772 | 772 | Inputs: |
|
773 | 773 | profileList : Index of profiles selected. Example: profileList = (0,1,2,7,8) |
|
774 | 774 | |
|
775 | 775 | profileRangeList : Minimum and maximum profile indexes. Example: profileRangeList = (4, 30) |
|
776 | 776 | |
|
777 | 777 | rangeList : List of profile ranges. Example: rangeList = ((4, 30), (32, 64), (128, 256)) |
|
778 | 778 | |
|
779 | 779 | """ |
|
780 | 780 | |
|
781 | 781 | dataOut.flagNoData = True |
|
782 | self.nProfiles = dataOut.nProfiles | |
|
782 | ||
|
783 | if nProfiles: | |
|
784 | self.nProfiles = dataOut.nProfiles | |
|
785 | else: | |
|
786 | self.nProfiles = nProfiles | |
|
783 | 787 | |
|
784 | 788 | if dataOut.flagDataAsBlock: |
|
785 | 789 | """ |
|
786 | 790 | data dimension = [nChannels, nProfiles, nHeis] |
|
787 | 791 | """ |
|
788 | 792 | if profileList != None: |
|
789 | 793 | dataOut.data = dataOut.data[:,profileList,:] |
|
790 | 794 | dataOut.nProfiles = len(profileList) |
|
791 | 795 | dataOut.profileIndex = dataOut.nProfiles - 1 |
|
792 | 796 | |
|
793 | 797 | if profileRangeList != None: |
|
794 | 798 | minIndex = profileRangeList[0] |
|
795 | 799 | maxIndex = profileRangeList[1] |
|
796 | 800 | |
|
797 | 801 | dataOut.data = dataOut.data[:,minIndex:maxIndex+1,:] |
|
798 | 802 | dataOut.nProfiles = maxIndex - minIndex + 1 |
|
799 | 803 | dataOut.profileIndex = dataOut.nProfiles - 1 |
|
800 | 804 | |
|
801 | 805 | if rangeList != None: |
|
802 | 806 | raise ValueError, "Profile Selector: Not implemented for rangeList yet" |
|
803 | 807 | |
|
804 | 808 | dataOut.flagNoData = False |
|
805 | 809 | |
|
806 | 810 | return True |
|
807 | 811 | |
|
808 | 812 | else: |
|
809 | 813 | """ |
|
810 | 814 | data dimension = [nChannels, nHeis] |
|
811 | 815 | |
|
812 | 816 | """ |
|
813 | 817 | if profileList != None: |
|
814 | 818 | |
|
815 | 819 | dataOut.nProfiles = len(profileList) |
|
816 | 820 | |
|
817 | 821 | if self.isThisProfileInList(dataOut.profileIndex, profileList): |
|
818 | 822 | dataOut.flagNoData = False |
|
819 | 823 | dataOut.profileIndex = self.profileIndex |
|
820 | 824 | |
|
821 | 825 | self.incIndex() |
|
822 | 826 | return True |
|
823 | 827 | |
|
824 | 828 | |
|
825 | 829 | if profileRangeList != None: |
|
826 | 830 | |
|
827 | 831 | minIndex = profileRangeList[0] |
|
828 | 832 | maxIndex = profileRangeList[1] |
|
829 | 833 | |
|
830 | 834 | dataOut.nProfiles = maxIndex - minIndex + 1 |
|
831 | 835 | |
|
832 | 836 | if self.isThisProfileInRange(dataOut.profileIndex, minIndex, maxIndex): |
|
833 | 837 | dataOut.flagNoData = False |
|
834 | 838 | dataOut.profileIndex = self.profileIndex |
|
835 | 839 | |
|
836 | 840 | self.incIndex() |
|
837 | 841 | return True |
|
838 | 842 | |
|
839 | 843 | if rangeList != None: |
|
840 | 844 | |
|
841 | 845 | nProfiles = 0 |
|
842 | 846 | |
|
843 | 847 | for thisRange in rangeList: |
|
844 | 848 | minIndex = thisRange[0] |
|
845 | 849 | maxIndex = thisRange[1] |
|
846 | 850 | |
|
847 | 851 | nProfiles += maxIndex - minIndex + 1 |
|
848 | 852 | |
|
849 | 853 | dataOut.nProfiles = nProfiles |
|
850 | 854 | |
|
851 | 855 | for thisRange in rangeList: |
|
852 | 856 | |
|
853 | 857 | minIndex = thisRange[0] |
|
854 | 858 | maxIndex = thisRange[1] |
|
855 | 859 | |
|
856 | 860 | if self.isThisProfileInRange(dataOut.profileIndex, minIndex, maxIndex): |
|
857 | 861 | |
|
858 | 862 | # print "profileIndex = ", dataOut.profileIndex |
|
859 | 863 | |
|
860 | 864 | dataOut.flagNoData = False |
|
861 | 865 | dataOut.profileIndex = self.profileIndex |
|
862 | 866 | |
|
863 | 867 | self.incIndex() |
|
864 | 868 | break |
|
865 | 869 | return True |
|
866 | 870 | |
|
867 | 871 | |
|
868 | 872 | if beam != None: #beam is only for AMISR data |
|
869 | 873 | if self.isThisProfileInList(dataOut.profileIndex, dataOut.beamRangeDict[beam]): |
|
870 | 874 | dataOut.flagNoData = False |
|
871 | 875 | dataOut.profileIndex = self.profileIndex |
|
872 | 876 | |
|
873 | 877 | self.incIndex() |
|
874 | 878 | return 1 |
|
875 | 879 | |
|
876 | 880 | raise ValueError, "ProfileSelector needs profileList, profileRangeList or rangeList parameter" |
|
877 | 881 | |
|
878 | 882 | return 0 |
|
879 | 883 | |
|
880 | 884 | |
|
881 | 885 | |
|
882 | 886 | class Reshaper(Operation): |
|
883 | 887 | |
|
884 | 888 | def __init__(self): |
|
885 | 889 | |
|
886 | 890 | Operation.__init__(self) |
|
887 | 891 | self.updateNewHeights = True |
|
888 | 892 | |
|
889 | 893 | def run(self, dataOut, shape): |
|
890 | 894 | |
|
891 | 895 | if not dataOut.flagDataAsBlock: |
|
892 | 896 | raise ValueError, "Reshaper can only be used when voltage have been read as Block, getBlock = True" |
|
893 | 897 | |
|
894 | 898 | if len(shape) != 3: |
|
895 | 899 | raise ValueError, "shape len should be equal to 3, (nChannels, nProfiles, nHeis)" |
|
896 | 900 | |
|
897 | 901 | shape_tuple = tuple(shape) |
|
898 | 902 | dataOut.data = numpy.reshape(dataOut.data, shape_tuple) |
|
899 | 903 | dataOut.flagNoData = False |
|
900 | 904 | |
|
901 | 905 | if self.updateNewHeights: |
|
902 | 906 | |
|
903 | 907 | old_nheights = dataOut.nHeights |
|
904 | 908 | new_nheights = dataOut.data.shape[2] |
|
905 | 909 | factor = 1.0*new_nheights / old_nheights |
|
906 | 910 | |
|
907 | 911 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] |
|
908 | 912 | |
|
909 | 913 | xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * factor |
|
910 | 914 | |
|
911 | 915 | dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight) |
|
912 | 916 | |
|
913 | 917 | dataOut.nProfiles = dataOut.data.shape[1] |
|
914 | 918 | |
|
915 | 919 | dataOut.ippSeconds *= factor |
|
916 | 920 | |
|
917 | 921 | import collections |
|
918 | 922 | from scipy.stats import mode |
|
919 | 923 | |
|
920 | 924 | class Synchronize(Operation): |
|
921 | 925 | |
|
922 | 926 | isConfig = False |
|
923 | 927 | __profIndex = 0 |
|
924 | 928 | |
|
925 | 929 | def __init__(self): |
|
926 | 930 | |
|
927 | 931 | Operation.__init__(self) |
|
928 | 932 | # self.isConfig = False |
|
929 | 933 | self.__powBuffer = None |
|
930 | 934 | self.__startIndex = 0 |
|
931 | 935 | self.__pulseFound = False |
|
932 | 936 | |
|
933 | 937 | def __findTxPulse(self, dataOut, channel=0, pulse_with = None): |
|
934 | 938 | |
|
935 | 939 | #Read data |
|
936 | 940 | |
|
937 | 941 | powerdB = dataOut.getPower(channel = channel) |
|
938 | 942 | noisedB = dataOut.getNoise(channel = channel)[0] |
|
939 | 943 | |
|
940 | 944 | self.__powBuffer.extend(powerdB.flatten()) |
|
941 | 945 | |
|
942 | 946 | dataArray = numpy.array(self.__powBuffer) |
|
943 | 947 | |
|
944 | 948 | filteredPower = numpy.correlate(dataArray, dataArray[0:self.__nSamples], "same") |
|
945 | 949 | |
|
946 | 950 | maxValue = numpy.nanmax(filteredPower) |
|
947 | 951 | |
|
948 | 952 | if maxValue < noisedB + 10: |
|
949 | 953 | #No se encuentra ningun pulso de transmision |
|
950 | 954 | return None |
|
951 | 955 | |
|
952 | 956 | maxValuesIndex = numpy.where(filteredPower > maxValue - 0.1*abs(maxValue))[0] |
|
953 | 957 | |
|
954 | 958 | if len(maxValuesIndex) < 2: |
|
955 | 959 | #Solo se encontro un solo pulso de transmision de un baudio, esperando por el siguiente TX |
|
956 | 960 | return None |
|
957 | 961 | |
|
958 | 962 | phasedMaxValuesIndex = maxValuesIndex - self.__nSamples |
|
959 | 963 | |
|
960 | 964 | #Seleccionar solo valores con un espaciamiento de nSamples |
|
961 | 965 | pulseIndex = numpy.intersect1d(maxValuesIndex, phasedMaxValuesIndex) |
|
962 | 966 | |
|
963 | 967 | if len(pulseIndex) < 2: |
|
964 | 968 | #Solo se encontro un pulso de transmision con ancho mayor a 1 |
|
965 | 969 | return None |
|
966 | 970 | |
|
967 | 971 | spacing = pulseIndex[1:] - pulseIndex[:-1] |
|
968 | 972 | |
|
969 | 973 | #remover senales que se distancien menos de 10 unidades o muestras |
|
970 | 974 | #(No deberian existir IPP menor a 10 unidades) |
|
971 | 975 | |
|
972 | 976 | realIndex = numpy.where(spacing > 10 )[0] |
|
973 | 977 | |
|
974 | 978 | if len(realIndex) < 2: |
|
975 | 979 | #Solo se encontro un pulso de transmision con ancho mayor a 1 |
|
976 | 980 | return None |
|
977 | 981 | |
|
978 | 982 | #Eliminar pulsos anchos (deja solo la diferencia entre IPPs) |
|
979 | 983 | realPulseIndex = pulseIndex[realIndex] |
|
980 | 984 | |
|
981 | 985 | period = mode(realPulseIndex[1:] - realPulseIndex[:-1])[0][0] |
|
982 | 986 | |
|
983 | 987 | print "IPP = %d samples" %period |
|
984 | 988 | |
|
985 | 989 | self.__newNSamples = dataOut.nHeights #int(period) |
|
986 | 990 | self.__startIndex = int(realPulseIndex[0]) |
|
987 | 991 | |
|
988 | 992 | return 1 |
|
989 | 993 | |
|
990 | 994 | |
|
991 | 995 | def setup(self, nSamples, nChannels, buffer_size = 4): |
|
992 | 996 | |
|
993 | 997 | self.__powBuffer = collections.deque(numpy.zeros( buffer_size*nSamples,dtype=numpy.float), |
|
994 | 998 | maxlen = buffer_size*nSamples) |
|
995 | 999 | |
|
996 | 1000 | bufferList = [] |
|
997 | 1001 | |
|
998 | 1002 | for i in range(nChannels): |
|
999 | 1003 | bufferByChannel = collections.deque(numpy.zeros( buffer_size*nSamples, dtype=numpy.complex) + numpy.NAN, |
|
1000 | 1004 | maxlen = buffer_size*nSamples) |
|
1001 | 1005 | |
|
1002 | 1006 | bufferList.append(bufferByChannel) |
|
1003 | 1007 | |
|
1004 | 1008 | self.__nSamples = nSamples |
|
1005 | 1009 | self.__nChannels = nChannels |
|
1006 | 1010 | self.__bufferList = bufferList |
|
1007 | 1011 | |
|
1008 | 1012 | def run(self, dataOut, channel = 0): |
|
1009 | 1013 | |
|
1010 | 1014 | if not self.isConfig: |
|
1011 | 1015 | nSamples = dataOut.nHeights |
|
1012 | 1016 | nChannels = dataOut.nChannels |
|
1013 | 1017 | self.setup(nSamples, nChannels) |
|
1014 | 1018 | self.isConfig = True |
|
1015 | 1019 | |
|
1016 | 1020 | #Append new data to internal buffer |
|
1017 | 1021 | for thisChannel in range(self.__nChannels): |
|
1018 | 1022 | bufferByChannel = self.__bufferList[thisChannel] |
|
1019 | 1023 | bufferByChannel.extend(dataOut.data[thisChannel]) |
|
1020 | 1024 | |
|
1021 | 1025 | if self.__pulseFound: |
|
1022 | 1026 | self.__startIndex -= self.__nSamples |
|
1023 | 1027 | |
|
1024 | 1028 | #Finding Tx Pulse |
|
1025 | 1029 | if not self.__pulseFound: |
|
1026 | 1030 | indexFound = self.__findTxPulse(dataOut, channel) |
|
1027 | 1031 | |
|
1028 | 1032 | if indexFound == None: |
|
1029 | 1033 | dataOut.flagNoData = True |
|
1030 | 1034 | return |
|
1031 | 1035 | |
|
1032 | 1036 | self.__arrayBuffer = numpy.zeros((self.__nChannels, self.__newNSamples), dtype = numpy.complex) |
|
1033 | 1037 | self.__pulseFound = True |
|
1034 | 1038 | self.__startIndex = indexFound |
|
1035 | 1039 | |
|
1036 | 1040 | #If pulse was found ... |
|
1037 | 1041 | for thisChannel in range(self.__nChannels): |
|
1038 | 1042 | bufferByChannel = self.__bufferList[thisChannel] |
|
1039 | 1043 | #print self.__startIndex |
|
1040 | 1044 | x = numpy.array(bufferByChannel) |
|
1041 | 1045 | self.__arrayBuffer[thisChannel] = x[self.__startIndex:self.__startIndex+self.__newNSamples] |
|
1042 | 1046 | |
|
1043 | 1047 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] |
|
1044 | 1048 | dataOut.heightList = numpy.arange(self.__newNSamples)*deltaHeight |
|
1045 | 1049 | # dataOut.ippSeconds = (self.__newNSamples / deltaHeight)/1e6 |
|
1046 | 1050 | |
|
1047 | 1051 | dataOut.data = self.__arrayBuffer |
|
1048 | 1052 | |
|
1049 | 1053 | self.__startIndex += self.__newNSamples |
|
1050 | 1054 | |
|
1051 | 1055 | return No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now