@@ -1,6074 +1,6082 | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 | 3 | Module implementing MainWindow. |
|
4 | 4 | #+++++++++++++GUI V1++++++++++++++# |
|
5 | 5 | @author: AlexanderValdezPortocarrero |
|
6 | 6 | |
|
7 | 7 | #+++++++++++++GUI V2++++++++++++++# |
|
8 | 8 | @author Miguel Urco |
|
9 | 9 | """ |
|
10 | 10 | import os, sys |
|
11 | 11 | import datetime |
|
12 | 12 | import numpy |
|
13 | 13 | import ast |
|
14 | 14 | |
|
15 | 15 | from Queue import Queue |
|
16 | 16 | |
|
17 | 17 | from collections import OrderedDict |
|
18 | 18 | from os.path import expanduser |
|
19 | 19 | from time import sleep |
|
20 | 20 | |
|
21 | 21 | from PyQt4.QtGui import QMainWindow |
|
22 | 22 | from PyQt4.QtCore import pyqtSignature |
|
23 | 23 | from PyQt4.QtCore import pyqtSignal |
|
24 | 24 | from PyQt4 import QtCore |
|
25 | 25 | from PyQt4 import QtGui |
|
26 | 26 | |
|
27 | 27 | from propertiesViewModel import TreeModel, PropertyBuffer |
|
28 | 28 | from parametersModel import ProjectParms |
|
29 | 29 | |
|
30 | 30 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess |
|
31 | 31 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp |
|
32 | 32 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow |
|
33 | 33 | |
|
34 | 34 | from schainpy.controller_api import ControllerThread |
|
35 | 35 | from schainpy.controller import Project |
|
36 | 36 | |
|
37 | 37 | from schainpy.model.graphics.jroplotter import PlotManager |
|
38 | 38 | from schainpy.gui.figures import tools |
|
39 | 39 | |
|
40 | 40 | FIGURES_PATH = tools.get_path() |
|
41 | 41 | TEMPORAL_FILE = ".temp.xml" |
|
42 | 42 | |
|
43 | 43 | def isRadarFile(file): |
|
44 | 44 | try: |
|
45 | 45 | year = int(file[1:5]) |
|
46 | 46 | doy = int(file[5:8]) |
|
47 | 47 | set = int(file[8:11]) |
|
48 | 48 | except: |
|
49 | 49 | return 0 |
|
50 | 50 | |
|
51 | 51 | return 1 |
|
52 | 52 | |
|
53 | 53 | def isRadarPath(path): |
|
54 | 54 | try: |
|
55 | 55 | year = int(path[1:5]) |
|
56 | 56 | doy = int(path[5:8]) |
|
57 | 57 | except: |
|
58 | 58 | return 0 |
|
59 | 59 | |
|
60 | 60 | return 1 |
|
61 | 61 | |
|
62 | 62 | def isInt(cadena): |
|
63 | 63 | |
|
64 | 64 | try: |
|
65 | 65 | int(cadena) |
|
66 | 66 | except: |
|
67 | 67 | return 0 |
|
68 | 68 | |
|
69 | 69 | return 1 |
|
70 | 70 | |
|
71 | 71 | def isFloat(cadena): |
|
72 | 72 | |
|
73 | 73 | try: |
|
74 | 74 | float(cadena) |
|
75 | 75 | except: |
|
76 | 76 | return 0 |
|
77 | 77 | |
|
78 | 78 | return 1 |
|
79 | 79 | |
|
80 | 80 | def isList(cadena): |
|
81 | 81 | |
|
82 | 82 | value = str.strip(cadena) |
|
83 | 83 | |
|
84 | 84 | if not value: |
|
85 | 85 | return 0 |
|
86 | 86 | |
|
87 | 87 | try: |
|
88 | 88 | x = ast.literal_eval(value) |
|
89 | 89 | except: |
|
90 | 90 | return 0 |
|
91 | 91 | |
|
92 | 92 | if type(x) in (int, float, tuple, list): |
|
93 | 93 | return 1 |
|
94 | 94 | |
|
95 | 95 | return 0 |
|
96 | 96 | |
|
97 | 97 | def isIntList(cadena): |
|
98 | 98 | |
|
99 | 99 | value = str.strip(cadena) |
|
100 | 100 | |
|
101 | 101 | if not value: |
|
102 | 102 | return 0 |
|
103 | 103 | |
|
104 | 104 | try: |
|
105 | 105 | x = ast.literal_eval(value) |
|
106 | 106 | except: |
|
107 | 107 | return 0 |
|
108 | 108 | |
|
109 | 109 | if type(x) not in (int, tuple, list): |
|
110 | 110 | return 0 |
|
111 | 111 | |
|
112 | 112 | return 1 |
|
113 | 113 | |
|
114 | 114 | def isFloatRange(cadena): |
|
115 | 115 | |
|
116 | 116 | value = str.strip(cadena) |
|
117 | 117 | |
|
118 | 118 | if not value: |
|
119 | 119 | return 0 |
|
120 | 120 | |
|
121 | 121 | c = str.split(value, ",") |
|
122 | 122 | |
|
123 | 123 | if len(c) != 2: |
|
124 | 124 | return 0 |
|
125 | 125 | |
|
126 | 126 | if not isFloat(c[0]): |
|
127 | 127 | return 0 |
|
128 | 128 | |
|
129 | 129 | if not isFloat(c[1]): |
|
130 | 130 | return 0 |
|
131 | 131 | |
|
132 | 132 | return 1 |
|
133 | 133 | |
|
134 | 134 | def isIntRange(cadena): |
|
135 | 135 | |
|
136 | 136 | value = str.strip(cadena) |
|
137 | 137 | |
|
138 | 138 | if not value: |
|
139 | 139 | return 0 |
|
140 | 140 | |
|
141 | 141 | c = str.split(value, ",") |
|
142 | 142 | |
|
143 | 143 | if len(c) != 2: |
|
144 | 144 | return 0 |
|
145 | 145 | |
|
146 | 146 | if not isInt(c[0]): |
|
147 | 147 | return 0 |
|
148 | 148 | |
|
149 | 149 | if not isInt(c[1]): |
|
150 | 150 | return 0 |
|
151 | 151 | |
|
152 | 152 | def isPair(value): |
|
153 | 153 | |
|
154 | 154 | if type(value) not in (tuple, list): |
|
155 | 155 | return 0 |
|
156 | 156 | |
|
157 | 157 | if len(value) != 2: |
|
158 | 158 | return 0 |
|
159 | 159 | |
|
160 | 160 | for i in value: |
|
161 | 161 | if type(i) not in (int,): |
|
162 | 162 | return 0 |
|
163 | 163 | |
|
164 | 164 | return 1 |
|
165 | 165 | |
|
166 | 166 | def isPairList(cadena): |
|
167 | 167 | |
|
168 | 168 | value = str.strip(cadena) |
|
169 | 169 | |
|
170 | 170 | if not value: |
|
171 | 171 | return 0 |
|
172 | 172 | |
|
173 | 173 | try: |
|
174 | 174 | x = ast.literal_eval(value) |
|
175 | 175 | except: |
|
176 | 176 | return 0 |
|
177 | 177 | |
|
178 | 178 | if type(x) not in (tuple, list): |
|
179 | 179 | return 0 |
|
180 | 180 | |
|
181 | 181 | if type(x[0]) not in (tuple, list): |
|
182 | 182 | #x = (0,1) |
|
183 | 183 | if not isPair(x): |
|
184 | 184 | return 0 |
|
185 | 185 | |
|
186 | 186 | return 1 |
|
187 | 187 | |
|
188 | 188 | for thisPair in x: |
|
189 | 189 | if not isPair(thisPair): |
|
190 | 190 | return 0 |
|
191 | 191 | |
|
192 | 192 | return 1 |
|
193 | 193 | |
|
194 | 194 | def isMultiList(cadena): |
|
195 | 195 | |
|
196 | 196 | value = str.strip(cadena) |
|
197 | 197 | |
|
198 | 198 | if not value: |
|
199 | 199 | return 0 |
|
200 | 200 | |
|
201 | 201 | try: |
|
202 | 202 | x = ast.literal_eval(value) |
|
203 | 203 | except: |
|
204 | 204 | return 0 |
|
205 | 205 | |
|
206 | 206 | if type(x) not in (tuple, list): |
|
207 | 207 | return 0 |
|
208 | 208 | |
|
209 | 209 | for thisList in x: |
|
210 | 210 | if type(thisList) not in (int, float, tuple, list): |
|
211 | 211 | return 0 |
|
212 | 212 | |
|
213 | 213 | return 1 |
|
214 | 214 | |
|
215 | 215 | def getCode(cadena): |
|
216 | 216 | |
|
217 | 217 | if not isMultiList(cadena): |
|
218 | 218 | return None |
|
219 | 219 | |
|
220 | 220 | try: |
|
221 | 221 | x = ast.literal_eval(cadena) |
|
222 | 222 | except: |
|
223 | 223 | return None |
|
224 | 224 | |
|
225 | 225 | if type(x[0]) in (int, float): |
|
226 | 226 | return [x] |
|
227 | 227 | |
|
228 | 228 | return x |
|
229 | 229 | |
|
230 | 230 | |
|
231 | 231 | class BasicWindow(QMainWindow, Ui_BasicWindow): |
|
232 | 232 | """ |
|
233 | 233 | """ |
|
234 | 234 | def __init__(self, parent=None): |
|
235 | 235 | """ |
|
236 | 236 | |
|
237 | 237 | """ |
|
238 | 238 | QMainWindow.__init__(self, parent) |
|
239 | 239 | self.setupUi(self) |
|
240 | 240 | self.__puObjDict = {} |
|
241 | 241 | self.__itemTreeDict = {} |
|
242 | 242 | self.readUnitConfObjList = [] |
|
243 | 243 | self.operObjList = [] |
|
244 | 244 | self.projecObjView = None |
|
245 | 245 | self.idProject = 0 |
|
246 | 246 | # self.idImag = 0 |
|
247 | 247 | |
|
248 | 248 | self.idImagscope = 0 |
|
249 | 249 | self.idImagspectra = 0 |
|
250 | 250 | self.idImagcross = 0 |
|
251 | 251 | self.idImagrti = 0 |
|
252 | 252 | self.idImagcoherence = 0 |
|
253 | 253 | self.idImagpower = 0 |
|
254 | 254 | self.idImagrtinoise = 0 |
|
255 | 255 | self.idImagspectraHeis = 0 |
|
256 | 256 | self.idImagrtiHeis = 0 |
|
257 | 257 | |
|
258 | 258 | self.dateList = [] |
|
259 | 259 | self.dataPath = None |
|
260 | 260 | self.create = False |
|
261 | 261 | self.selectedItemTree = None |
|
262 | 262 | self.controllerThread = None |
|
263 | 263 | # self.commCtrlPThread = None |
|
264 | 264 | # self.create_figure() |
|
265 | 265 | self.temporalFTP = ftpBuffer() |
|
266 | 266 | self.projectProperCaracteristica = [] |
|
267 | 267 | self.projectProperPrincipal = [] |
|
268 | 268 | self.projectProperDescripcion = [] |
|
269 | 269 | self.volProperCaracteristica = [] |
|
270 | 270 | self.volProperPrincipal = [] |
|
271 | 271 | self.volProperDescripcion = [] |
|
272 | 272 | self.specProperCaracteristica = [] |
|
273 | 273 | self.specProperPrincipal = [] |
|
274 | 274 | self.specProperDescripcion = [] |
|
275 | 275 | |
|
276 | 276 | self.specHeisProperCaracteristica = [] |
|
277 | 277 | self.specHeisProperPrincipal = [] |
|
278 | 278 | self.specHeisProperDescripcion = [] |
|
279 | 279 | |
|
280 | 280 | # self.pathWorkSpace = './' |
|
281 | 281 | |
|
282 | 282 | self.__projectObjDict = {} |
|
283 | 283 | self.__operationObjDict = {} |
|
284 | 284 | |
|
285 | 285 | self.__puLocalFolder2FTP = {} |
|
286 | 286 | self.threadStarted = False |
|
287 | 287 | |
|
288 | 288 | self.plotManager = None |
|
289 | 289 | |
|
290 | 290 | # self.create_comm() |
|
291 | 291 | self.create_updating_timer() |
|
292 | 292 | self.setGUIStatus() |
|
293 | 293 | |
|
294 | 294 | @pyqtSignature("") |
|
295 | 295 | def on_actionOpen_triggered(self): |
|
296 | 296 | """ |
|
297 | 297 | Slot documentation goes here. |
|
298 | 298 | """ |
|
299 | 299 | self.openProject() |
|
300 | 300 | |
|
301 | 301 | @pyqtSignature("") |
|
302 | 302 | def on_actionCreate_triggered(self): |
|
303 | 303 | """ |
|
304 | 304 | Slot documentation goes here. |
|
305 | 305 | """ |
|
306 | 306 | self.setInputsProject_View() |
|
307 | 307 | self.create = True |
|
308 | 308 | |
|
309 | 309 | @pyqtSignature("") |
|
310 | 310 | def on_actionSave_triggered(self): |
|
311 | 311 | """ |
|
312 | 312 | Slot documentation goes here. |
|
313 | 313 | """ |
|
314 | 314 | self.saveProject() |
|
315 | 315 | |
|
316 | 316 | @pyqtSignature("") |
|
317 | 317 | def on_actionClose_triggered(self): |
|
318 | 318 | """ |
|
319 | 319 | Slot documentation goes here. |
|
320 | 320 | """ |
|
321 | 321 | self.close() |
|
322 | 322 | |
|
323 | 323 | @pyqtSignature("") |
|
324 | 324 | def on_actionStart_triggered(self): |
|
325 | 325 | """ |
|
326 | 326 | """ |
|
327 | 327 | self.playProject() |
|
328 | 328 | |
|
329 | 329 | @pyqtSignature("") |
|
330 | 330 | def on_actionPause_triggered(self): |
|
331 | 331 | """ |
|
332 | 332 | """ |
|
333 | 333 | self.pauseProject() |
|
334 | 334 | |
|
335 | 335 | @pyqtSignature("") |
|
336 | 336 | def on_actionStop_triggered(self): |
|
337 | 337 | """ |
|
338 | 338 | """ |
|
339 | 339 | self.stopProject() |
|
340 | 340 | |
|
341 | 341 | @pyqtSignature("") |
|
342 | 342 | def on_actionAbout_triggered(self): |
|
343 | 343 | """ |
|
344 | 344 | """ |
|
345 | 345 | self.aboutEvent() |
|
346 | 346 | |
|
347 | 347 | @pyqtSignature("") |
|
348 | 348 | def on_actionFTP_triggered(self): |
|
349 | 349 | """ |
|
350 | 350 | """ |
|
351 | 351 | self.configFTPWindowObj = Ftp(self) |
|
352 | 352 | |
|
353 | 353 | if not self.temporalFTP.create: |
|
354 | 354 | self.temporalFTP.setwithoutconfiguration() |
|
355 | 355 | |
|
356 | 356 | self.configFTPWindowObj.setParmsfromTemporal(self.temporalFTP.server, |
|
357 | 357 | self.temporalFTP.remotefolder, |
|
358 | 358 | self.temporalFTP.username, |
|
359 | 359 | self.temporalFTP.password, |
|
360 | 360 | self.temporalFTP.ftp_wei, |
|
361 | 361 | self.temporalFTP.exp_code, |
|
362 | 362 | self.temporalFTP.sub_exp_code, |
|
363 | 363 | self.temporalFTP.plot_pos) |
|
364 | 364 | |
|
365 | 365 | self.configFTPWindowObj.show() |
|
366 | 366 | self.configFTPWindowObj.closed.connect(self.createFTPConfig) |
|
367 | 367 | |
|
368 | 368 | def createFTPConfig(self): |
|
369 | 369 | |
|
370 | 370 | if not self.configFTPWindowObj.create: |
|
371 | 371 | self.console.clear() |
|
372 | 372 | self.console.append("There is no FTP configuration") |
|
373 | 373 | return |
|
374 | 374 | |
|
375 | 375 | self.console.append("Push Ok in Spectra view to Add FTP Configuration") |
|
376 | 376 | |
|
377 | 377 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.configFTPWindowObj.getParmsFromFtpWindow() |
|
378 | 378 | self.temporalFTP.save(server=server, |
|
379 | 379 | remotefolder=remotefolder, |
|
380 | 380 | username=username, |
|
381 | 381 | password=password, |
|
382 | 382 | ftp_wei=ftp_wei, |
|
383 | 383 | exp_code=exp_code, |
|
384 | 384 | sub_exp_code=sub_exp_code, |
|
385 | 385 | plot_pos=plot_pos) |
|
386 | 386 | |
|
387 | 387 | @pyqtSignature("") |
|
388 | 388 | def on_actionOpenToolbar_triggered(self): |
|
389 | 389 | """ |
|
390 | 390 | Slot documentation goes here. |
|
391 | 391 | """ |
|
392 | 392 | self.openProject() |
|
393 | 393 | |
|
394 | 394 | @pyqtSignature("") |
|
395 | 395 | def on_actionCreateToolbar_triggered(self): |
|
396 | 396 | """ |
|
397 | 397 | Slot documentation goes here. |
|
398 | 398 | """ |
|
399 | 399 | self.setInputsProject_View() |
|
400 | 400 | self.create = True |
|
401 | 401 | |
|
402 | 402 | @pyqtSignature("") |
|
403 | 403 | def on_actionAddPU_triggered(self): |
|
404 | 404 | |
|
405 | 405 | if len(self.__projectObjDict) == 0: |
|
406 | 406 | outputstr = "First create a Project before add any Processing Unit" |
|
407 | 407 | self.console.clear() |
|
408 | 408 | self.console.append(outputstr) |
|
409 | 409 | return |
|
410 | 410 | else: |
|
411 | 411 | self.addPUWindow() |
|
412 | 412 | self.console.clear() |
|
413 | 413 | self.console.append("Please, Choose the type of Processing Unit") |
|
414 | 414 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
415 | 415 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
416 | 416 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
417 | 417 | |
|
418 | 418 | |
|
419 | 419 | @pyqtSignature("") |
|
420 | 420 | def on_actionSaveToolbar_triggered(self): |
|
421 | 421 | """ |
|
422 | 422 | Slot documentation goes here. |
|
423 | 423 | """ |
|
424 | 424 | self.saveProject() |
|
425 | 425 | |
|
426 | 426 | @pyqtSignature("") |
|
427 | 427 | def on_actionStarToolbar_triggered(self): |
|
428 | 428 | """ |
|
429 | 429 | Slot documentation goes here. |
|
430 | 430 | """ |
|
431 | 431 | self.playProject() |
|
432 | 432 | |
|
433 | 433 | @pyqtSignature("") |
|
434 | 434 | def on_actionPauseToolbar_triggered(self): |
|
435 | 435 | |
|
436 | 436 | self.pauseProject() |
|
437 | 437 | |
|
438 | 438 | @pyqtSignature("") |
|
439 | 439 | def on_actionStopToolbar_triggered(self): |
|
440 | 440 | """ |
|
441 | 441 | Slot documentation goes here. |
|
442 | 442 | """ |
|
443 | 443 | self.stopProject() |
|
444 | 444 | |
|
445 | 445 | @pyqtSignature("int") |
|
446 | 446 | def on_proComReadMode_activated(self, index): |
|
447 | 447 | """ |
|
448 | 448 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 |
|
449 | 449 | """ |
|
450 | 450 | if index == 0: |
|
451 | 451 | # self.proDelay.setText("0") |
|
452 | 452 | self.proSet.setEnabled(True) |
|
453 | 453 | self.proDelay.setEnabled(False) |
|
454 | 454 | elif index == 1: |
|
455 | 455 | self.proSet.setText("") |
|
456 | 456 | # self.proDelay.setText("5") |
|
457 | 457 | self.proSet.setEnabled(False) |
|
458 | 458 | self.proDelay.setEnabled(True) |
|
459 | 459 | |
|
460 | 460 | |
|
461 | 461 | def __setRawDataWindow(self): |
|
462 | 462 | |
|
463 | 463 | self.__setPDataWindow() |
|
464 | 464 | |
|
465 | 465 | self.frame_data.show() |
|
466 | 466 | |
|
467 | 467 | self.labnTxs.show() |
|
468 | 468 | self.pronTxs.show() |
|
469 | 469 | |
|
470 | 470 | self.labByBlock.show() |
|
471 | 471 | self.proComByBlock.show() |
|
472 | 472 | |
|
473 | 473 | def __setPDataWindow(self): |
|
474 | 474 | |
|
475 | 475 | self.labelIPPKm.hide() |
|
476 | 476 | self.proIPPKm.hide() |
|
477 | 477 | |
|
478 | 478 | self.labelSet.show() |
|
479 | 479 | self.proSet.show() |
|
480 | 480 | |
|
481 | 481 | self.labExpLabel.show() |
|
482 | 482 | self.proExpLabel.show() |
|
483 | 483 | |
|
484 | 484 | self.labelWalk.show() |
|
485 | 485 | self.proComWalk.show() |
|
486 | 486 | |
|
487 | 487 | self.frame_data.hide() |
|
488 | 488 | |
|
489 | 489 | # self.labnTxs.hide() |
|
490 | 490 | # self.pronTxs.hide() |
|
491 | 491 | # |
|
492 | 492 | # self.labByBlock.hide() |
|
493 | 493 | # self.proComByBlock.hide() |
|
494 | 494 | |
|
495 | 495 | def __setUSRPDataWindow(self): |
|
496 | 496 | |
|
497 | 497 | self.frame_data.show() |
|
498 | 498 | |
|
499 | 499 | self.labelIPPKm.show() |
|
500 | 500 | self.proIPPKm.show() |
|
501 | 501 | |
|
502 | 502 | self.labelSet.hide() |
|
503 | 503 | self.proSet.hide() |
|
504 | 504 | |
|
505 | 505 | self.labExpLabel.hide() |
|
506 | 506 | self.proExpLabel.hide() |
|
507 | 507 | |
|
508 | 508 | self.labelWalk.hide() |
|
509 | 509 | self.proComWalk.hide() |
|
510 | 510 | |
|
511 | 511 | self.labnTxs.hide() |
|
512 | 512 | self.pronTxs.hide() |
|
513 | 513 | |
|
514 | 514 | self.labByBlock.hide() |
|
515 | 515 | self.proComByBlock.hide() |
|
516 | 516 | |
|
517 | 517 | @pyqtSignature("int") |
|
518 | 518 | def on_proComDataType_activated(self, index): |
|
519 | 519 | """ |
|
520 | 520 | Voltage or Spectra |
|
521 | 521 | """ |
|
522 | 522 | |
|
523 | 523 | if index == 0: |
|
524 | 524 | extension = '.r' |
|
525 | 525 | self.__setRawDataWindow() |
|
526 | 526 | |
|
527 | 527 | elif index == 1: |
|
528 | 528 | extension = '.pdata' |
|
529 | 529 | self.__setPDataWindow() |
|
530 | 530 | |
|
531 | 531 | |
|
532 | 532 | elif index == 2: |
|
533 | 533 | extension = '.fits' |
|
534 | 534 | self.__setPDataWindow() |
|
535 | 535 | |
|
536 | 536 | elif index == 3: |
|
537 | 537 | extension = '.hdf5' |
|
538 | 538 | self.__setUSRPDataWindow() |
|
539 | 539 | |
|
540 | 540 | self.proDataType.setText(extension) |
|
541 | 541 | |
|
542 | 542 | @pyqtSignature("int") |
|
543 | 543 | def on_proComWalk_activated(self, index): |
|
544 | 544 | """ |
|
545 | 545 | |
|
546 | 546 | """ |
|
547 | 547 | if index == 0: |
|
548 | 548 | self.proExpLabel.setEnabled(False) |
|
549 | 549 | elif index == 1: |
|
550 | 550 | self.proExpLabel.setEnabled(True) |
|
551 | 551 | |
|
552 | 552 | @pyqtSignature("") |
|
553 | 553 | def on_proToolPath_clicked(self): |
|
554 | 554 | """ |
|
555 | 555 | Choose your path |
|
556 | 556 | """ |
|
557 | 557 | |
|
558 | 558 | current_dpath = './' |
|
559 | 559 | if self.dataPath: |
|
560 | 560 | current_dpath = self.dataPath |
|
561 | 561 | |
|
562 | 562 | datapath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', current_dpath, QtGui.QFileDialog.ShowDirsOnly)) |
|
563 | 563 | |
|
564 | 564 | #If it was canceled |
|
565 | 565 | if not datapath: |
|
566 | 566 | return |
|
567 | 567 | |
|
568 | 568 | #If any change was done |
|
569 | 569 | if datapath == self.dataPath: |
|
570 | 570 | return |
|
571 | 571 | |
|
572 | 572 | self.proDataPath.setText(datapath) |
|
573 | 573 | |
|
574 | 574 | self._disable_play_button() |
|
575 | 575 | self._disable_save_button() |
|
576 | 576 | self.proOk.setEnabled(False) |
|
577 | 577 | |
|
578 | 578 | self.proComStartDate.clear() |
|
579 | 579 | self.proComEndDate.clear() |
|
580 | 580 | |
|
581 | 581 | if not os.path.exists(datapath): |
|
582 | 582 | |
|
583 | 583 | self.console.clear() |
|
584 | 584 | self.console.append("Write a valid path") |
|
585 | 585 | return |
|
586 | 586 | |
|
587 | 587 | self.dataPath = datapath |
|
588 | 588 | |
|
589 | 589 | self.console.clear() |
|
590 | 590 | self.console.append("Select the read mode and press 'load button'") |
|
591 | 591 | |
|
592 | 592 | |
|
593 | 593 | @pyqtSignature("") |
|
594 | 594 | def on_proLoadButton_clicked(self): |
|
595 | 595 | |
|
596 | 596 | self.console.clear() |
|
597 | 597 | |
|
598 | 598 | projectParms = self.__getParmsFromProjectWindow() |
|
599 | 599 | |
|
600 | 600 | if not projectParms.online: |
|
601 | 601 | self.proComStartDate.clear() |
|
602 | 602 | self.proComEndDate.clear() |
|
603 | 603 | self.proComStartDate.setEnabled(True) |
|
604 | 604 | self.proComEndDate.setEnabled(True) |
|
605 | 605 | self.proStartTime.setEnabled(True) |
|
606 | 606 | self.proEndTime.setEnabled(True) |
|
607 | 607 | self.frame_2.setEnabled(True) |
|
608 | 608 | |
|
609 | 609 | else: |
|
610 | 610 | self.proComStartDate.addItem("1960/01/30") |
|
611 | 611 | self.proComEndDate.addItem("2018/12/31") |
|
612 | 612 | self.proComStartDate.setEnabled(False) |
|
613 | 613 | self.proComEndDate.setEnabled(False) |
|
614 | 614 | self.proStartTime.setEnabled(False) |
|
615 | 615 | self.proEndTime.setEnabled(False) |
|
616 | 616 | self.frame_2.setEnabled(True) |
|
617 | 617 | |
|
618 | 618 | if self.loadDays(projectParms.dpath, projectParms.ext, projectParms.walk, projectParms.expLabel) == []: |
|
619 | 619 | self._disable_save_button() |
|
620 | 620 | self._disable_play_button() |
|
621 | 621 | self.proOk.setEnabled(False) |
|
622 | 622 | else: |
|
623 | 623 | self._enable_save_button() |
|
624 | 624 | self._enable_play_button() |
|
625 | 625 | self.proOk.setEnabled(True) |
|
626 | 626 | |
|
627 | 627 | @pyqtSignature("int") |
|
628 | 628 | def on_proComStartDate_activated(self, index): |
|
629 | 629 | """ |
|
630 | 630 | SELECCION DEL RANGO DE FECHAS -START DATE |
|
631 | 631 | """ |
|
632 | 632 | stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex() - 1 |
|
633 | 633 | |
|
634 | 634 | self.proComEndDate.clear() |
|
635 | 635 | for i in self.dateList[index:]: |
|
636 | 636 | self.proComEndDate.addItem(i) |
|
637 | 637 | |
|
638 | 638 | if self.proComEndDate.count() - stopIndex - 1 >= 0: |
|
639 | 639 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex - 1) |
|
640 | 640 | else: |
|
641 | 641 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
642 | 642 | |
|
643 | 643 | @pyqtSignature("int") |
|
644 | 644 | def on_proComEndDate_activated(self, index): |
|
645 | 645 | """ |
|
646 | 646 | SELECCION DEL RANGO DE FECHAS-END DATE |
|
647 | 647 | """ |
|
648 | 648 | pass |
|
649 | 649 | |
|
650 | 650 | @pyqtSignature("") |
|
651 | 651 | def on_proOk_clicked(self): |
|
652 | 652 | """ |
|
653 | 653 | AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. |
|
654 | 654 | Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2 |
|
655 | 655 | """ |
|
656 | 656 | |
|
657 | 657 | self._disable_play_button() |
|
658 | 658 | self._disable_save_button() |
|
659 | 659 | |
|
660 | 660 | self.console.clear() |
|
661 | 661 | |
|
662 | 662 | if self.create: |
|
663 | 663 | |
|
664 | 664 | projectId = self.__getNewProjectId() |
|
665 | 665 | |
|
666 | 666 | if not projectId: |
|
667 | 667 | return 0 |
|
668 | 668 | |
|
669 | 669 | projectObjView = self.createProjectView(projectId) |
|
670 | 670 | |
|
671 | 671 | if not projectObjView: |
|
672 | 672 | return 0 |
|
673 | 673 | |
|
674 | 674 | self.create = False |
|
675 | 675 | |
|
676 | 676 | readUnitObj = self.createReadUnitView(projectObjView) |
|
677 | 677 | |
|
678 | 678 | if not readUnitObj: |
|
679 | 679 | return 0 |
|
680 | 680 | |
|
681 | 681 | else: |
|
682 | 682 | projectObjView = self.updateProjectView() |
|
683 | 683 | |
|
684 | 684 | if not projectObjView: |
|
685 | 685 | return 0 |
|
686 | 686 | |
|
687 | 687 | projectId = projectObjView.getId() |
|
688 | 688 | idReadUnit = projectObjView.getReadUnitId() |
|
689 | 689 | readUnitObj = self.updateReadUnitView(projectObjView, idReadUnit) |
|
690 | 690 | |
|
691 | 691 | if not readUnitObj: |
|
692 | 692 | return 0 |
|
693 | 693 | |
|
694 | 694 | self.__itemTreeDict[projectId].setText(projectObjView.name) |
|
695 | 695 | # Project Properties |
|
696 | 696 | self.refreshProjectProperties(projectObjView) |
|
697 | 697 | # Disable tabProject after finish the creation |
|
698 | 698 | |
|
699 | 699 | self._enable_play_button() |
|
700 | 700 | self._enable_save_button() |
|
701 | 701 | |
|
702 | 702 | self.console.clear() |
|
703 | 703 | self.console.append("The project parameters were validated") |
|
704 | 704 | |
|
705 | 705 | return 1 |
|
706 | 706 | |
|
707 | 707 | @pyqtSignature("") |
|
708 | 708 | def on_proClear_clicked(self): |
|
709 | 709 | |
|
710 | 710 | self.console.clear() |
|
711 | 711 | |
|
712 | 712 | @pyqtSignature("int") |
|
713 | 713 | def on_volOpCebChannels_stateChanged(self, p0): |
|
714 | 714 | """ |
|
715 | 715 | Check Box habilita operaciones de SelecciοΏ½n de Canales |
|
716 | 716 | """ |
|
717 | 717 | if p0 == 2: |
|
718 | 718 | self.volOpComChannels.setEnabled(True) |
|
719 | 719 | self.volOpChannel.setEnabled(True) |
|
720 | 720 | |
|
721 | 721 | if p0 == 0: |
|
722 | 722 | self.volOpComChannels.setEnabled(False) |
|
723 | 723 | self.volOpChannel.setEnabled(False) |
|
724 | 724 | # self.volOpChannel.clear() |
|
725 | 725 | |
|
726 | 726 | @pyqtSignature("int") |
|
727 | 727 | def on_volOpCebHeights_stateChanged(self, p0): |
|
728 | 728 | """ |
|
729 | 729 | Check Box habilita operaciones de SelecciοΏ½n de Alturas |
|
730 | 730 | """ |
|
731 | 731 | if p0 == 2: |
|
732 | 732 | self.volOpHeights.setEnabled(True) |
|
733 | 733 | self.volOpComHeights.setEnabled(True) |
|
734 | 734 | |
|
735 | 735 | if p0 == 0: |
|
736 | 736 | self.volOpHeights.setEnabled(False) |
|
737 | 737 | # self.volOpHeights.clear() |
|
738 | 738 | self.volOpComHeights.setEnabled(False) |
|
739 | 739 | |
|
740 | 740 | @pyqtSignature("int") |
|
741 | 741 | def on_volOpCebFilter_stateChanged(self, p0): |
|
742 | 742 | """ |
|
743 | 743 | Name='Decoder', optype='other' |
|
744 | 744 | """ |
|
745 | 745 | if p0 == 2: |
|
746 | 746 | self.volOpFilter.setEnabled(True) |
|
747 | 747 | |
|
748 | 748 | if p0 == 0: |
|
749 | 749 | self.volOpFilter.setEnabled(False) |
|
750 | 750 | # self.volOpFilter.clear() |
|
751 | 751 | |
|
752 | 752 | @pyqtSignature("int") |
|
753 | 753 | def on_volOpCebProfile_stateChanged(self, p0): |
|
754 | 754 | """ |
|
755 | 755 | Check Box habilita ingreso del rango de Perfiles |
|
756 | 756 | """ |
|
757 | 757 | if p0 == 2: |
|
758 | 758 | self.volOpComProfile.setEnabled(True) |
|
759 | 759 | self.volOpProfile.setEnabled(True) |
|
760 | 760 | |
|
761 | 761 | if p0 == 0: |
|
762 | 762 | self.volOpComProfile.setEnabled(False) |
|
763 | 763 | self.volOpProfile.setEnabled(False) |
|
764 | 764 | # self.volOpProfile.clear() |
|
765 | 765 | |
|
766 | 766 | @pyqtSignature("int") |
|
767 | 767 | def on_volOpComProfile_activated(self, index): |
|
768 | 768 | """ |
|
769 | 769 | Check Box habilita ingreso del rango de Perfiles |
|
770 | 770 | """ |
|
771 | 771 | #Profile List |
|
772 | 772 | if index == 0: |
|
773 | 773 | self.volOpProfile.setToolTip('List of selected profiles. Example: 0, 1, 2, 3, 4, 5, 6, 7') |
|
774 | 774 | |
|
775 | 775 | #Profile Range |
|
776 | 776 | if index == 1: |
|
777 | 777 | self.volOpProfile.setToolTip('Minimum and maximum profile index. Example: 0, 7') |
|
778 | 778 | |
|
779 | 779 | #Profile Range List |
|
780 | 780 | if index == 2: |
|
781 | 781 | self.volOpProfile.setToolTip('List of profile ranges. Example: (0, 7), (12, 19), (100, 200)') |
|
782 | 782 | |
|
783 | 783 | @pyqtSignature("int") |
|
784 | 784 | def on_volOpCebDecodification_stateChanged(self, p0): |
|
785 | 785 | """ |
|
786 | 786 | Check Box habilita |
|
787 | 787 | """ |
|
788 | 788 | if p0 == 2: |
|
789 | 789 | self.volOpComCode.setEnabled(True) |
|
790 | 790 | self.volOpComMode.setEnabled(True) |
|
791 | 791 | if p0 == 0: |
|
792 | 792 | self.volOpComCode.setEnabled(False) |
|
793 | 793 | self.volOpComMode.setEnabled(False) |
|
794 | 794 | |
|
795 | 795 | @pyqtSignature("int") |
|
796 | 796 | def on_volOpComCode_activated(self, index): |
|
797 | 797 | """ |
|
798 | 798 | Check Box habilita ingreso |
|
799 | 799 | """ |
|
800 | 800 | if index == 13: |
|
801 | 801 | self.volOpCode.setEnabled(True) |
|
802 | 802 | else: |
|
803 | 803 | self.volOpCode.setEnabled(False) |
|
804 | 804 | |
|
805 | 805 | if index == 0: |
|
806 | 806 | # code = '' |
|
807 | 807 | # self.volOpCode.setText(str(code)) |
|
808 | 808 | return |
|
809 | 809 | |
|
810 | 810 | if index == 1: |
|
811 | 811 | code = '(1,1,-1)' |
|
812 | 812 | nCode = '1' |
|
813 | 813 | nBaud = '3' |
|
814 | 814 | if index == 2: |
|
815 | 815 | code = '(1,1,-1,1)' |
|
816 | 816 | nCode = '1' |
|
817 | 817 | nBaud = '4' |
|
818 | 818 | if index == 3: |
|
819 | 819 | code = '(1,1,1,-1,1)' |
|
820 | 820 | nCode = '1' |
|
821 | 821 | nBaud = '5' |
|
822 | 822 | if index == 4: |
|
823 | 823 | code = '(1,1,1,-1,-1,1,-1)' |
|
824 | 824 | nCode = '1' |
|
825 | 825 | nBaud = '7' |
|
826 | 826 | if index == 5: |
|
827 | 827 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1)' |
|
828 | 828 | nCode = '1' |
|
829 | 829 | nBaud = '11' |
|
830 | 830 | if index == 6: |
|
831 | 831 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)' |
|
832 | 832 | nCode = '1' |
|
833 | 833 | nBaud = '13' |
|
834 | 834 | if index == 7: |
|
835 | 835 | code = '(1,1,-1,-1,-1,1)' |
|
836 | 836 | nCode = '2' |
|
837 | 837 | nBaud = '3' |
|
838 | 838 | if index == 8: |
|
839 | 839 | code = '(1,1,-1,1,-1,-1,1,-1)' |
|
840 | 840 | nCode = '2' |
|
841 | 841 | nBaud = '4' |
|
842 | 842 | if index == 9: |
|
843 | 843 | code = '(1,1,1,-1,1,-1,-1,-1,1,-1)' |
|
844 | 844 | nCode = '2' |
|
845 | 845 | nBaud = '5' |
|
846 | 846 | if index == 10: |
|
847 | 847 | code = '(1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1)' |
|
848 | 848 | nCode = '2' |
|
849 | 849 | nBaud = '7' |
|
850 | 850 | if index == 11: |
|
851 | 851 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1 ,-1 ,-1 ,1 ,1,1,-1 ,1 ,1 ,-1 ,1)' |
|
852 | 852 | nCode = '2' |
|
853 | 853 | nBaud = '11' |
|
854 | 854 | if index == 12: |
|
855 | 855 | 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)' |
|
856 | 856 | nCode = '2' |
|
857 | 857 | nBaud = '13' |
|
858 | 858 | |
|
859 | 859 | code = ast.literal_eval(code) |
|
860 | 860 | nCode = int(nCode) |
|
861 | 861 | nBaud = int(nBaud) |
|
862 | 862 | |
|
863 | 863 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
864 | 864 | |
|
865 | 865 | self.volOpCode.setText(str(code)) |
|
866 | 866 | |
|
867 | 867 | @pyqtSignature("int") |
|
868 | 868 | def on_volOpCebFlip_stateChanged(self, p0): |
|
869 | 869 | """ |
|
870 | 870 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
871 | 871 | """ |
|
872 | 872 | if p0 == 2: |
|
873 | 873 | self.volOpFlip.setEnabled(True) |
|
874 | 874 | if p0 == 0: |
|
875 | 875 | self.volOpFlip.setEnabled(False) |
|
876 | 876 | # self.volOpFlip.clear() |
|
877 | 877 | |
|
878 | 878 | @pyqtSignature("int") |
|
879 | 879 | def on_volOpCebCohInt_stateChanged(self, p0): |
|
880 | 880 | """ |
|
881 | 881 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
882 | 882 | """ |
|
883 | 883 | if p0 == 2: |
|
884 | 884 | self.volOpCohInt.setEnabled(True) |
|
885 | 885 | if p0 == 0: |
|
886 | 886 | self.volOpCohInt.setEnabled(False) |
|
887 | 887 | # self.volOpCohInt.clear() |
|
888 | 888 | |
|
889 | 889 | @pyqtSignature("int") |
|
890 | 890 | def on_volOpCebRadarfrequency_stateChanged(self, p0): |
|
891 | 891 | """ |
|
892 | 892 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
893 | 893 | """ |
|
894 | 894 | if p0 == 2: |
|
895 | 895 | self.volOpRadarfrequency.setEnabled(True) |
|
896 | 896 | if p0 == 0: |
|
897 | 897 | self.volOpRadarfrequency.clear() |
|
898 | 898 | self.volOpRadarfrequency.setEnabled(False) |
|
899 | 899 | |
|
900 | 900 | @pyqtSignature("") |
|
901 | 901 | def on_volOutputToolPath_clicked(self): |
|
902 | 902 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
903 | 903 | self.volOutputPath.setText(dirOutPath) |
|
904 | 904 | |
|
905 | 905 | @pyqtSignature("") |
|
906 | 906 | def on_specOutputToolPath_clicked(self): |
|
907 | 907 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
908 | 908 | self.specOutputPath.setText(dirOutPath) |
|
909 | 909 | |
|
910 | 910 | @pyqtSignature("") |
|
911 | 911 | def on_specHeisOutputToolPath_clicked(self): |
|
912 | 912 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
913 | 913 | self.specHeisOutputPath.setText(dirOutPath) |
|
914 | 914 | |
|
915 | 915 | @pyqtSignature("") |
|
916 | 916 | def on_specHeisOutputMetadaToolPath_clicked(self): |
|
917 | 917 | |
|
918 | 918 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
919 | 919 | self.specHeisOutputMetada.setText(filename) |
|
920 | 920 | |
|
921 | 921 | @pyqtSignature("") |
|
922 | 922 | def on_volOpOk_clicked(self): |
|
923 | 923 | """ |
|
924 | 924 | BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO |
|
925 | 925 | PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML |
|
926 | 926 | """ |
|
927 | 927 | |
|
928 | 928 | checkPath = False |
|
929 | 929 | |
|
930 | 930 | self._disable_play_button() |
|
931 | 931 | self._disable_save_button() |
|
932 | 932 | |
|
933 | 933 | self.console.clear() |
|
934 | 934 | self.console.append("Checking input parameters:\n") |
|
935 | 935 | |
|
936 | 936 | puObj = self.getSelectedItemObj() |
|
937 | 937 | puObj.removeOperations() |
|
938 | 938 | |
|
939 | 939 | if self.volOpCebRadarfrequency.isChecked(): |
|
940 | 940 | value = str(self.volOpRadarfrequency.text()) |
|
941 | 941 | format = 'float' |
|
942 | 942 | name_operation = 'setRadarFrequency' |
|
943 | 943 | name_parameter = 'frequency' |
|
944 | 944 | |
|
945 | 945 | if not isFloat(value): |
|
946 | 946 | self.console.append("Invalid value '%s' for Radar Frequency" %value) |
|
947 | 947 | return 0 |
|
948 | 948 | |
|
949 | 949 | opObj = puObj.addOperation(name=name_operation) |
|
950 | 950 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
951 | 951 | |
|
952 | 952 | if self.volOpCebChannels.isChecked(): |
|
953 | 953 | |
|
954 | 954 | format = 'intlist' |
|
955 | 955 | if self.volOpComChannels.currentIndex() == 0: |
|
956 | 956 | name_operation = "selectChannels" |
|
957 | 957 | name_parameter = 'channelList' |
|
958 | 958 | else: |
|
959 | 959 | name_operation = "selectChannelsByIndex" |
|
960 | 960 | name_parameter = 'channelIndexList' |
|
961 | 961 | |
|
962 | 962 | value = str(self.volOpChannel.text()) |
|
963 | 963 | |
|
964 | 964 | if not isIntList(value): |
|
965 | 965 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
966 | 966 | return 0 |
|
967 | 967 | |
|
968 | 968 | opObj = puObj.addOperation(name=name_operation) |
|
969 | 969 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
970 | 970 | |
|
971 | 971 | if self.volOpCebHeights.isChecked(): |
|
972 | 972 | value = str(self.volOpHeights.text()) |
|
973 | 973 | |
|
974 | 974 | if not isFloatRange(value): |
|
975 | 975 | self.console.append("Invalid value '%s' for Height range" %value) |
|
976 | 976 | return 0 |
|
977 | 977 | |
|
978 | 978 | valueList = value.split(',') |
|
979 | 979 | |
|
980 | 980 | if self.volOpComHeights.currentIndex() == 0: |
|
981 | 981 | format = 'float' |
|
982 | 982 | name_operation = 'selectHeights' |
|
983 | 983 | name_parameter1 = 'minHei' |
|
984 | 984 | name_parameter2 = 'maxHei' |
|
985 | 985 | else: |
|
986 | 986 | format = 'int' |
|
987 | 987 | name_operation = 'selectHeightsByIndex' |
|
988 | 988 | name_parameter1 = 'minIndex' |
|
989 | 989 | name_parameter2 = 'maxIndex' |
|
990 | 990 | |
|
991 | 991 | opObj = puObj.addOperation(name=name_operation) |
|
992 | 992 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) |
|
993 | 993 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) |
|
994 | 994 | |
|
995 | 995 | if self.volOpCebFilter.isChecked(): |
|
996 | 996 | value = str(self.volOpFilter.text()) |
|
997 | 997 | |
|
998 | 998 | if not isInt(value): |
|
999 | 999 | self.console.append("Invalid value '%s' for Filter" %value) |
|
1000 | 1000 | return 0 |
|
1001 | 1001 | |
|
1002 | 1002 | format = 'int' |
|
1003 | 1003 | name_operation = 'filterByHeights' |
|
1004 | 1004 | name_parameter = 'window' |
|
1005 | 1005 | opObj = puObj.addOperation(name=name_operation) |
|
1006 | 1006 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1007 | 1007 | |
|
1008 | 1008 | if self.volOpCebProfile.isChecked(): |
|
1009 | 1009 | value = str(self.volOpProfile.text()) |
|
1010 | 1010 | |
|
1011 | 1011 | format = 'intlist' |
|
1012 | 1012 | optype = 'other' |
|
1013 | 1013 | name_operation = 'ProfileSelector' |
|
1014 | 1014 | |
|
1015 | 1015 | if self.volOpComProfile.currentIndex() == 0: |
|
1016 | 1016 | name_parameter = 'profileList' |
|
1017 | 1017 | if self.volOpComProfile.currentIndex() == 1: |
|
1018 | 1018 | name_parameter = 'profileRangeList' |
|
1019 | 1019 | if self.volOpComProfile.currentIndex() == 2: |
|
1020 | 1020 | name_parameter = 'rangeList' |
|
1021 | 1021 | |
|
1022 | 1022 | if not isIntList(value): |
|
1023 | 1023 | self.console.append("Invalid value '%s' for %s" %(value, name_parameter) ) |
|
1024 | 1024 | return 0 |
|
1025 | 1025 | |
|
1026 | 1026 | opObj = puObj.addOperation(name='ProfileSelector', optype='other') |
|
1027 | 1027 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1028 | 1028 | |
|
1029 | 1029 | if self.volOpCebDecodification.isChecked(): |
|
1030 | 1030 | name_operation = 'Decoder' |
|
1031 | 1031 | opObj = puObj.addOperation(name=name_operation, optype='other') |
|
1032 | 1032 | |
|
1033 | 1033 | if self.volOpComCode.currentIndex() != 0: |
|
1034 | 1034 | |
|
1035 | 1035 | code = str(self.volOpCode.text()) |
|
1036 | 1036 | |
|
1037 | 1037 | if not isMultiList(code): |
|
1038 | 1038 | self.console.append("Please write a valid Code (Example: [1,1,-1], [1,-1,1])") |
|
1039 | 1039 | return 0 |
|
1040 | 1040 | |
|
1041 | 1041 | real_code = getCode(code) |
|
1042 | 1042 | nCode = len(real_code) |
|
1043 | 1043 | nBaud = len(real_code[0]) |
|
1044 | 1044 | |
|
1045 | 1045 | opObj.addParameter(name='code', value=code, format='intlist') |
|
1046 | 1046 | opObj.addParameter(name='nCode', value=nCode, format='int') |
|
1047 | 1047 | opObj.addParameter(name='nBaud', value=nBaud, format='int') |
|
1048 | 1048 | |
|
1049 | 1049 | name_parameter = 'mode' |
|
1050 | 1050 | format = 'int' |
|
1051 | 1051 | value = str(self.volOpComMode.currentIndex()) |
|
1052 | 1052 | |
|
1053 | 1053 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1054 | 1054 | |
|
1055 | 1055 | |
|
1056 | 1056 | if self.volOpCebFlip.isChecked(): |
|
1057 | 1057 | name_operation = 'deFlip' |
|
1058 | 1058 | optype = 'self' |
|
1059 | 1059 | |
|
1060 | 1060 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1061 | 1061 | |
|
1062 | 1062 | value = str(self.volOpFlip.text()) |
|
1063 | 1063 | |
|
1064 | 1064 | if value: |
|
1065 | 1065 | |
|
1066 | 1066 | name_parameter = 'channelList' |
|
1067 | 1067 | format = 'intlist' |
|
1068 | 1068 | |
|
1069 | 1069 | if not isIntList(value): |
|
1070 | 1070 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
1071 | 1071 | return 0 |
|
1072 | 1072 | |
|
1073 | 1073 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1074 | 1074 | |
|
1075 | 1075 | if self.volOpCebCohInt.isChecked(): |
|
1076 | 1076 | name_operation = 'CohInt' |
|
1077 | 1077 | optype = 'other' |
|
1078 | 1078 | value = str(self.volOpCohInt.text()) |
|
1079 | 1079 | |
|
1080 | 1080 | if not isInt(value): |
|
1081 | 1081 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
1082 | 1082 | return 0 |
|
1083 | 1083 | |
|
1084 | 1084 | name_parameter = 'n' |
|
1085 | 1085 | format = 'int' |
|
1086 | 1086 | |
|
1087 | 1087 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1088 | 1088 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1089 | 1089 | |
|
1090 | 1090 | if self.volGraphCebshow.isChecked(): |
|
1091 | 1091 | name_operation = 'Scope' |
|
1092 | 1092 | optype = 'other' |
|
1093 | 1093 | |
|
1094 | 1094 | name_parameter1 = 'id' |
|
1095 | 1095 | format1 = 'int' |
|
1096 | 1096 | |
|
1097 | 1097 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1098 | 1098 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) |
|
1099 | 1099 | |
|
1100 | 1100 | channelList = str(self.volGraphChannelList.text()).strip() |
|
1101 | 1101 | xvalue = str(self.volGraphHeightrange.text()).strip() |
|
1102 | 1102 | yvalue = str(self.volGraphIntensityRange.text()).strip() |
|
1103 | 1103 | figpath = str(self.volGraphPath.text()).strip() |
|
1104 | 1104 | figfile = str(self.volGraphPrefix.text()).strip() |
|
1105 | 1105 | |
|
1106 | 1106 | if channelList != "": |
|
1107 | 1107 | if not isIntList(channelList): |
|
1108 | 1108 | self.console.append("Invalid value '%s' for 'Graphics:ChannelList'" %(channelList)) |
|
1109 | 1109 | return 0 |
|
1110 | 1110 | |
|
1111 | 1111 | if xvalue != "": |
|
1112 | 1112 | if not isFloatRange(xvalue): |
|
1113 | 1113 | self.console.append("Invalid value '%s' for 'Graphics:Height-Range'" %(xvalue)) |
|
1114 | 1114 | return 0 |
|
1115 | 1115 | |
|
1116 | 1116 | if yvalue != "": |
|
1117 | 1117 | if not isFloatRange(yvalue): |
|
1118 | 1118 | self.console.append("Invalid value '%s' for 'Graphics:Amplitude-Range'" %(yvalue)) |
|
1119 | 1119 | return 0 |
|
1120 | 1120 | |
|
1121 | 1121 | |
|
1122 | 1122 | if channelList: |
|
1123 | 1123 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1124 | 1124 | |
|
1125 | 1125 | if xvalue: |
|
1126 | 1126 | xvalueList = xvalue.split(',') |
|
1127 | 1127 | |
|
1128 | 1128 | opObj.addParameter(name='xmin', value=xvalueList[0], format='float') |
|
1129 | 1129 | opObj.addParameter(name='xmax', value=xvalueList[1], format='float') |
|
1130 | 1130 | |
|
1131 | 1131 | if yvalue: |
|
1132 | 1132 | yvalueList = yvalue.split(",") |
|
1133 | 1133 | |
|
1134 | 1134 | opObj.addParameter(name='ymin', value=yvalueList[0], format='int') |
|
1135 | 1135 | opObj.addParameter(name='ymax', value=yvalueList[1], format='int') |
|
1136 | 1136 | |
|
1137 | 1137 | plot_type = self.volComScopeType.currentIndex() |
|
1138 | 1138 | |
|
1139 | 1139 | if plot_type == 0: |
|
1140 | 1140 | opObj.addParameter(name='type', value="iq") |
|
1141 | 1141 | if plot_type == 1: |
|
1142 | 1142 | opObj.addParameter(name='type', value="power") |
|
1143 | 1143 | |
|
1144 | 1144 | if self.volGraphCebSave.isChecked(): |
|
1145 | 1145 | checkPath = True |
|
1146 | 1146 | |
|
1147 | 1147 | opObj.addParameter(name='save', value='1', format='int') |
|
1148 | 1148 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1149 | 1149 | |
|
1150 | 1150 | if figfile: |
|
1151 | 1151 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1152 | 1152 | |
|
1153 | 1153 | if checkPath: |
|
1154 | 1154 | |
|
1155 | 1155 | if not figpath: |
|
1156 | 1156 | self.console.clear() |
|
1157 | 1157 | self.console.append("Graphic path should be defined") |
|
1158 | 1158 | return 0 |
|
1159 | 1159 | |
|
1160 | 1160 | # if os.path.isdir(figpath): |
|
1161 | 1161 | # self.console.clear() |
|
1162 | 1162 | # self.console.append("Graphic path does not exist, it has to be created") |
|
1163 | 1163 | # return 0 |
|
1164 | 1164 | |
|
1165 | 1165 | self.console.clear() |
|
1166 | 1166 | |
|
1167 | 1167 | # if something happend |
|
1168 | 1168 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Voltage') |
|
1169 | 1169 | if parms_ok: |
|
1170 | 1170 | name_operation = 'VoltageWriter' |
|
1171 | 1171 | optype = 'other' |
|
1172 | 1172 | name_parameter1 = 'path' |
|
1173 | 1173 | name_parameter2 = 'blocksPerFile' |
|
1174 | 1174 | name_parameter3 = 'profilesPerBlock' |
|
1175 | 1175 | value1 = output_path |
|
1176 | 1176 | value2 = blocksperfile |
|
1177 | 1177 | value3 = profilesperblock |
|
1178 | 1178 | format = "int" |
|
1179 | 1179 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1180 | 1180 | opObj.addParameter(name=name_parameter1, value=value1) |
|
1181 | 1181 | opObj.addParameter(name=name_parameter2, value=value2, format=format) |
|
1182 | 1182 | opObj.addParameter(name=name_parameter3, value=value3, format=format) |
|
1183 | 1183 | |
|
1184 | 1184 | try: |
|
1185 | 1185 | self.refreshPUProperties(puObj) |
|
1186 | 1186 | except: |
|
1187 | 1187 | self.console.append("An error reading input parameters was found ...Check them!") |
|
1188 | 1188 | return 0 |
|
1189 | 1189 | |
|
1190 | 1190 | self.console.append("Save your project and press Play button to start signal processing") |
|
1191 | 1191 | |
|
1192 | 1192 | self._enable_play_button() |
|
1193 | 1193 | self._enable_save_button() |
|
1194 | 1194 | |
|
1195 | 1195 | return 1 |
|
1196 | 1196 | |
|
1197 | 1197 | @pyqtSignature("") |
|
1198 | 1198 | def on_volGraphClear_clicked(self): |
|
1199 | 1199 | |
|
1200 | 1200 | self.console.clear() |
|
1201 | 1201 | |
|
1202 | 1202 | """ |
|
1203 | 1203 | Voltage Graph |
|
1204 | 1204 | """ |
|
1205 | 1205 | @pyqtSignature("int") |
|
1206 | 1206 | def on_volGraphCebSave_stateChanged(self, p0): |
|
1207 | 1207 | """ |
|
1208 | 1208 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1209 | 1209 | """ |
|
1210 | 1210 | if p0 == 2: |
|
1211 | 1211 | self.volGraphPath.setEnabled(True) |
|
1212 | 1212 | self.volGraphPrefix.setEnabled(True) |
|
1213 | 1213 | self.volGraphToolPath.setEnabled(True) |
|
1214 | 1214 | |
|
1215 | 1215 | if p0 == 0: |
|
1216 | 1216 | self.volGraphPath.setEnabled(False) |
|
1217 | 1217 | self.volGraphPrefix.setEnabled(False) |
|
1218 | 1218 | self.volGraphToolPath.setEnabled(False) |
|
1219 | 1219 | |
|
1220 | 1220 | @pyqtSignature("") |
|
1221 | 1221 | def on_volGraphToolPath_clicked(self): |
|
1222 | 1222 | """ |
|
1223 | 1223 | Donde se guardan los DATOS |
|
1224 | 1224 | """ |
|
1225 | 1225 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
1226 | 1226 | self.volGraphPath.setText(save_path) |
|
1227 | 1227 | |
|
1228 | 1228 | if not os.path.exists(save_path): |
|
1229 | 1229 | self.console.clear() |
|
1230 | 1230 | self.console.append("Set a valid path") |
|
1231 | 1231 | self.volGraphOk.setEnabled(False) |
|
1232 | 1232 | return |
|
1233 | 1233 | |
|
1234 | 1234 | @pyqtSignature("int") |
|
1235 | 1235 | def on_volGraphCebshow_stateChanged(self, p0): |
|
1236 | 1236 | """ |
|
1237 | 1237 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1238 | 1238 | """ |
|
1239 | 1239 | if p0 == 0: |
|
1240 | 1240 | |
|
1241 | 1241 | self.volGraphChannelList.setEnabled(False) |
|
1242 | 1242 | self.volGraphIntensityRange.setEnabled(False) |
|
1243 | 1243 | self.volGraphHeightrange.setEnabled(False) |
|
1244 | 1244 | if p0 == 2: |
|
1245 | 1245 | |
|
1246 | 1246 | self.volGraphChannelList.setEnabled(True) |
|
1247 | 1247 | self.volGraphIntensityRange.setEnabled(True) |
|
1248 | 1248 | self.volGraphHeightrange.setEnabled(True) |
|
1249 | 1249 | |
|
1250 | 1250 | """ |
|
1251 | 1251 | Spectra operation |
|
1252 | 1252 | """ |
|
1253 | 1253 | @pyqtSignature("int") |
|
1254 | 1254 | def on_specOpCebRadarfrequency_stateChanged(self, p0): |
|
1255 | 1255 | """ |
|
1256 | 1256 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1257 | 1257 | """ |
|
1258 | 1258 | if p0 == 2: |
|
1259 | 1259 | self.specOpRadarfrequency.setEnabled(True) |
|
1260 | 1260 | if p0 == 0: |
|
1261 | 1261 | # self.specOpRadarfrequency.clear() |
|
1262 | 1262 | self.specOpRadarfrequency.setEnabled(False) |
|
1263 | 1263 | |
|
1264 | 1264 | |
|
1265 | 1265 | @pyqtSignature("int") |
|
1266 | 1266 | def on_specOpCebCrossSpectra_stateChanged(self, p0): |
|
1267 | 1267 | """ |
|
1268 | 1268 | Habilita la opcion de aοΏ½adir el parοΏ½metro CrossSpectra a la Unidad de Procesamiento . |
|
1269 | 1269 | """ |
|
1270 | 1270 | if p0 == 2: |
|
1271 | 1271 | # self.specOpnFFTpoints.setEnabled(True) |
|
1272 | 1272 | self.specOpComCrossSpectra.setEnabled(True) |
|
1273 | 1273 | self.specOppairsList.setEnabled(True) |
|
1274 | 1274 | |
|
1275 | 1275 | if p0 == 0: |
|
1276 | 1276 | # self.specOpnFFTpoints.setEnabled(False) |
|
1277 | 1277 | self.specOpComCrossSpectra.setEnabled(False) |
|
1278 | 1278 | self.specOppairsList.setEnabled(False) |
|
1279 | 1279 | |
|
1280 | 1280 | @pyqtSignature("int") |
|
1281 | 1281 | def on_specOpCebChannel_stateChanged(self, p0): |
|
1282 | 1282 | """ |
|
1283 | 1283 | Habilita la opcion de aοΏ½adir el parοΏ½metro numero de Canales a la Unidad de Procesamiento . |
|
1284 | 1284 | """ |
|
1285 | 1285 | if p0 == 2: |
|
1286 | 1286 | self.specOpChannel.setEnabled(True) |
|
1287 | 1287 | self.specOpComChannel.setEnabled(True) |
|
1288 | 1288 | if p0 == 0: |
|
1289 | 1289 | self.specOpChannel.setEnabled(False) |
|
1290 | 1290 | self.specOpComChannel.setEnabled(False) |
|
1291 | 1291 | |
|
1292 | 1292 | @pyqtSignature("int") |
|
1293 | 1293 | def on_specOpCebHeights_stateChanged(self, p0): |
|
1294 | 1294 | """ |
|
1295 | 1295 | Habilita la opcion de aοΏ½adir el parοΏ½metro de alturas a la Unidad de Procesamiento . |
|
1296 | 1296 | """ |
|
1297 | 1297 | if p0 == 2: |
|
1298 | 1298 | self.specOpComHeights.setEnabled(True) |
|
1299 | 1299 | self.specOpHeights.setEnabled(True) |
|
1300 | 1300 | if p0 == 0: |
|
1301 | 1301 | self.specOpComHeights.setEnabled(False) |
|
1302 | 1302 | self.specOpHeights.setEnabled(False) |
|
1303 | 1303 | |
|
1304 | 1304 | |
|
1305 | 1305 | @pyqtSignature("int") |
|
1306 | 1306 | def on_specOpCebIncoherent_stateChanged(self, p0): |
|
1307 | 1307 | """ |
|
1308 | 1308 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
1309 | 1309 | """ |
|
1310 | 1310 | if p0 == 2: |
|
1311 | 1311 | self.specOpIncoherent.setEnabled(True) |
|
1312 | 1312 | if p0 == 0: |
|
1313 | 1313 | self.specOpIncoherent.setEnabled(False) |
|
1314 | 1314 | |
|
1315 | 1315 | @pyqtSignature("int") |
|
1316 | 1316 | def on_specOpCebRemoveDC_stateChanged(self, p0): |
|
1317 | 1317 | """ |
|
1318 | 1318 | Habilita la opcion de aοΏ½adir el parοΏ½metro remover DC a la Unidad de Procesamiento . |
|
1319 | 1319 | """ |
|
1320 | 1320 | if p0 == 2: |
|
1321 | 1321 | self.specOpComRemoveDC.setEnabled(True) |
|
1322 | 1322 | if p0 == 0: |
|
1323 | 1323 | self.specOpComRemoveDC.setEnabled(False) |
|
1324 | 1324 | |
|
1325 | 1325 | @pyqtSignature("int") |
|
1326 | 1326 | def on_specOpCebgetNoise_stateChanged(self, p0): |
|
1327 | 1327 | """ |
|
1328 | 1328 | Habilita la opcion de aοΏ½adir la estimacion de ruido a la Unidad de Procesamiento . |
|
1329 | 1329 | """ |
|
1330 | 1330 | if p0 == 2: |
|
1331 | 1331 | self.specOpgetNoise.setEnabled(True) |
|
1332 | 1332 | |
|
1333 | 1333 | if p0 == 0: |
|
1334 | 1334 | self.specOpgetNoise.setEnabled(False) |
|
1335 | 1335 | |
|
1336 | 1336 | @pyqtSignature("") |
|
1337 | 1337 | def on_specOpOk_clicked(self): |
|
1338 | 1338 | """ |
|
1339 | 1339 | AΓADE OPERACION SPECTRA |
|
1340 | 1340 | """ |
|
1341 | 1341 | |
|
1342 | 1342 | addFTP = False |
|
1343 | 1343 | checkPath = False |
|
1344 | 1344 | |
|
1345 | 1345 | self._disable_play_button() |
|
1346 | 1346 | self._disable_save_button() |
|
1347 | 1347 | |
|
1348 | 1348 | self.console.clear() |
|
1349 | 1349 | self.console.append("Checking input parameters:\n") |
|
1350 | 1350 | |
|
1351 | 1351 | projectObj = self.getSelectedProjectObj() |
|
1352 | 1352 | |
|
1353 | 1353 | if not projectObj: |
|
1354 | 1354 | self.console.append("Please select a project before update it") |
|
1355 | 1355 | return |
|
1356 | 1356 | |
|
1357 | 1357 | puObj = self.getSelectedItemObj() |
|
1358 | 1358 | |
|
1359 | 1359 | puObj.removeOperations() |
|
1360 | 1360 | |
|
1361 | 1361 | if self.specOpCebRadarfrequency.isChecked(): |
|
1362 | 1362 | value = str(self.specOpRadarfrequency.text()) |
|
1363 | 1363 | format = 'float' |
|
1364 | 1364 | name_operation = 'setRadarFrequency' |
|
1365 | 1365 | name_parameter = 'frequency' |
|
1366 | 1366 | |
|
1367 | 1367 | if not isFloat(value): |
|
1368 | 1368 | self.console.clear() |
|
1369 | 1369 | self.console.append("Invalid value [%s] for '%s'" %(value, name_parameter)) |
|
1370 | 1370 | return 0 |
|
1371 | 1371 | |
|
1372 | 1372 | radarfreq = float(value)*1e6 |
|
1373 | 1373 | opObj = puObj.addOperation(name=name_operation) |
|
1374 | 1374 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
1375 | 1375 | |
|
1376 | 1376 | inputId = puObj.getInputId() |
|
1377 | 1377 | inputPuObj = projectObj.getProcUnitObj(inputId) |
|
1378 | 1378 | |
|
1379 | 1379 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': |
|
1380 | 1380 | |
|
1381 | 1381 | value = str(self.specOpnFFTpoints.text()) |
|
1382 | 1382 | |
|
1383 | 1383 | if not isInt(value): |
|
1384 | 1384 | self.console.append("Invalid value [%s] for '%s'" %(value, 'nFFTPoints')) |
|
1385 | 1385 | return 0 |
|
1386 | 1386 | |
|
1387 | 1387 | puObj.addParameter(name='nFFTPoints', value=value, format='int') |
|
1388 | 1388 | |
|
1389 | 1389 | value = str(self.specOpProfiles.text()) |
|
1390 | 1390 | if not isInt(value): |
|
1391 | 1391 | self.console.append("Please write a value on Profiles field") |
|
1392 | 1392 | else: |
|
1393 | 1393 | puObj.addParameter(name='nProfiles', value=value, format='int') |
|
1394 | 1394 | |
|
1395 | 1395 | value = str(self.specOpippFactor.text()) |
|
1396 | 1396 | if not isInt(value): |
|
1397 | 1397 | self.console.append("Please write a value on IppFactor field") |
|
1398 | 1398 | else: |
|
1399 | 1399 | puObj.addParameter(name='ippFactor' , value=value , format='int') |
|
1400 | 1400 | |
|
1401 | 1401 | if self.specOpCebCrossSpectra.isChecked(): |
|
1402 | 1402 | name_parameter = 'pairsList' |
|
1403 | 1403 | format = 'pairslist' |
|
1404 | 1404 | value = str(self.specOppairsList.text()) |
|
1405 | 1405 | |
|
1406 | 1406 | if not isPairList(value): |
|
1407 | 1407 | self.console.append("Invalid value [%s] for '%s'" %(value, name_parameter)) |
|
1408 | 1408 | return 0 |
|
1409 | 1409 | |
|
1410 | 1410 | puObj.addParameter(name=name_parameter, value=value, format=format) |
|
1411 | 1411 | |
|
1412 | 1412 | if self.specOpCebHeights.isChecked(): |
|
1413 | 1413 | value = str(self.specOpHeights.text()) |
|
1414 | 1414 | |
|
1415 | 1415 | if not isFloatRange(value): |
|
1416 | 1416 | self.console.append("Invalid value [%s] for Height range" %value) |
|
1417 | 1417 | return 0 |
|
1418 | 1418 | |
|
1419 | 1419 | valueList = value.split(',') |
|
1420 | 1420 | value0 = valueList[0] |
|
1421 | 1421 | value1 = valueList[1] |
|
1422 | 1422 | |
|
1423 | 1423 | if self.specOpComHeights.currentIndex() == 0: |
|
1424 | 1424 | name_operation = 'selectHeights' |
|
1425 | 1425 | name_parameter1 = 'minHei' |
|
1426 | 1426 | name_parameter2 = 'maxHei' |
|
1427 | 1427 | else: |
|
1428 | 1428 | name_operation = 'selectHeightsByIndex' |
|
1429 | 1429 | name_parameter1 = 'minIndex' |
|
1430 | 1430 | name_parameter2 = 'maxIndex' |
|
1431 | 1431 | |
|
1432 | 1432 | format = 'float' |
|
1433 | 1433 | |
|
1434 | 1434 | opObj = puObj.addOperation(name=name_operation) |
|
1435 | 1435 | opObj.addParameter(name=name_parameter1, value=value0, format=format) |
|
1436 | 1436 | opObj.addParameter(name=name_parameter2, value=value1, format=format) |
|
1437 | 1437 | |
|
1438 | 1438 | if self.specOpCebChannel.isChecked(): |
|
1439 | 1439 | |
|
1440 | 1440 | if self.specOpComChannel.currentIndex() == 0: |
|
1441 | 1441 | name_operation = "selectChannels" |
|
1442 | 1442 | name_parameter = 'channelList' |
|
1443 | 1443 | else: |
|
1444 | 1444 | name_operation = "selectChannelsByIndex" |
|
1445 | 1445 | name_parameter = 'channelIndexList' |
|
1446 | 1446 | |
|
1447 | 1447 | format = 'intlist' |
|
1448 | 1448 | value = str(self.specOpChannel.text()) |
|
1449 | 1449 | |
|
1450 | 1450 | if not isIntList(value): |
|
1451 | 1451 | self.console.append("Invalid value [%s] for '%s'" %(value, name_parameter)) |
|
1452 | 1452 | return 0 |
|
1453 | 1453 | |
|
1454 | 1454 | opObj = puObj.addOperation(name=name_operation) |
|
1455 | 1455 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1456 | 1456 | |
|
1457 | 1457 | if self.specOpCebIncoherent.isChecked(): |
|
1458 | 1458 | |
|
1459 | 1459 | name_operation = 'IncohInt' |
|
1460 | 1460 | optype = 'other' |
|
1461 | 1461 | |
|
1462 | 1462 | if self.specOpCobIncInt.currentIndex() == 0: |
|
1463 | 1463 | name_parameter = 'timeInterval' |
|
1464 | 1464 | format = 'float' |
|
1465 | 1465 | else: |
|
1466 | 1466 | name_parameter = 'n' |
|
1467 | 1467 | format = 'int' |
|
1468 | 1468 | |
|
1469 | 1469 | value = str(self.specOpIncoherent.text()) |
|
1470 | 1470 | |
|
1471 | 1471 | if not isFloat(value): |
|
1472 | 1472 | self.console.append("Invalid value [%s] for '%s'" %(value, name_parameter)) |
|
1473 | 1473 | return 0 |
|
1474 | 1474 | |
|
1475 | 1475 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1476 | 1476 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1477 | 1477 | |
|
1478 | 1478 | if self.specOpCebRemoveDC.isChecked(): |
|
1479 | 1479 | name_operation = 'removeDC' |
|
1480 | 1480 | name_parameter = 'mode' |
|
1481 | 1481 | format = 'int' |
|
1482 | 1482 | |
|
1483 | 1483 | if self.specOpComRemoveDC.currentIndex() == 0: |
|
1484 | 1484 | value = 1 |
|
1485 | 1485 | else: |
|
1486 | 1486 | value = 2 |
|
1487 | 1487 | |
|
1488 | 1488 | opObj = puObj.addOperation(name=name_operation) |
|
1489 | 1489 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1490 | 1490 | |
|
1491 | 1491 | if self.specOpCebRemoveInt.isChecked(): |
|
1492 | 1492 | name_operation = 'removeInterference' |
|
1493 | 1493 | opObj = puObj.addOperation(name=name_operation) |
|
1494 | 1494 | |
|
1495 | 1495 | |
|
1496 | 1496 | if self.specOpCebgetNoise.isChecked(): |
|
1497 | 1497 | value = str(self.specOpgetNoise.text()) |
|
1498 | 1498 | valueList = value.split(',') |
|
1499 | 1499 | format = 'float' |
|
1500 | 1500 | name_operation = "getNoise" |
|
1501 | 1501 | opObj = puObj.addOperation(name=name_operation) |
|
1502 | 1502 | |
|
1503 | 1503 | if not value == '': |
|
1504 | 1504 | valueList = value.split(',') |
|
1505 | 1505 | length = len(valueList) |
|
1506 | 1506 | if length == 1: |
|
1507 | 1507 | try: |
|
1508 | 1508 | value1 = float(valueList[0]) |
|
1509 | 1509 | except: |
|
1510 | 1510 | self.console.clear() |
|
1511 | 1511 | self.console.append("Please Write correct parameter Get Noise") |
|
1512 | 1512 | return 0 |
|
1513 | 1513 | name1 = 'minHei' |
|
1514 | 1514 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1515 | 1515 | elif length == 2: |
|
1516 | 1516 | try: |
|
1517 | 1517 | value1 = float(valueList[0]) |
|
1518 | 1518 | value2 = float(valueList[1]) |
|
1519 | 1519 | except: |
|
1520 | 1520 | self.console.clear() |
|
1521 | 1521 | self.console.append("Please Write corrects parameter Get Noise") |
|
1522 | 1522 | return 0 |
|
1523 | 1523 | name1 = 'minHei' |
|
1524 | 1524 | name2 = 'maxHei' |
|
1525 | 1525 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1526 | 1526 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1527 | 1527 | |
|
1528 | 1528 | elif length == 3: |
|
1529 | 1529 | try: |
|
1530 | 1530 | value1 = float(valueList[0]) |
|
1531 | 1531 | value2 = float(valueList[1]) |
|
1532 | 1532 | value3 = float(valueList[2]) |
|
1533 | 1533 | except: |
|
1534 | 1534 | self.console.clear() |
|
1535 | 1535 | self.console.append("Please Write corrects parameter Get Noise") |
|
1536 | 1536 | return 0 |
|
1537 | 1537 | name1 = 'minHei' |
|
1538 | 1538 | name2 = 'maxHei' |
|
1539 | 1539 | name3 = 'minVel' |
|
1540 | 1540 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1541 | 1541 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1542 | 1542 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1543 | 1543 | |
|
1544 | 1544 | elif length == 4: |
|
1545 | 1545 | try: |
|
1546 | 1546 | value1 = float(valueList[0]) |
|
1547 | 1547 | value2 = float(valueList[1]) |
|
1548 | 1548 | value3 = float(valueList[2]) |
|
1549 | 1549 | value4 = float(valueList[3]) |
|
1550 | 1550 | except: |
|
1551 | 1551 | self.console.clear() |
|
1552 | 1552 | self.console.append("Please Write corrects parameter Get Noise") |
|
1553 | 1553 | return 0 |
|
1554 | 1554 | name1 = 'minHei' |
|
1555 | 1555 | name2 = 'maxHei' |
|
1556 | 1556 | name3 = 'minVel' |
|
1557 | 1557 | name4 = 'maxVel' |
|
1558 | 1558 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1559 | 1559 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1560 | 1560 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1561 | 1561 | opObj.addParameter(name=name4, value=value4, format=format) |
|
1562 | 1562 | |
|
1563 | 1563 | elif length > 4: |
|
1564 | 1564 | self.console.clear() |
|
1565 | 1565 | self.console.append("Get Noise Operation only accepts 4 parameters") |
|
1566 | 1566 | return 0 |
|
1567 | 1567 | |
|
1568 | 1568 | channelList = str(self.specGgraphChannelList.text()).strip() |
|
1569 | 1569 | vel_range = str(self.specGgraphFreq.text()).strip() |
|
1570 | 1570 | hei_range = str(self.specGgraphHeight.text()).strip() |
|
1571 | 1571 | db_range = str(self.specGgraphDbsrange.text()).strip() |
|
1572 | 1572 | |
|
1573 | 1573 | trange = str(self.specGgraphTminTmax.text()).strip() |
|
1574 | 1574 | magrange = str(self.specGgraphmagnitud.text()).strip() |
|
1575 | 1575 | phaserange = str(self.specGgraphPhase.text()).strip() |
|
1576 |
|
|
|
1576 | timerange = str(self.specGgraphTimeRange.text()).strip() | |
|
1577 | 1577 | |
|
1578 | 1578 | figpath = str(self.specGraphPath.text()).strip() |
|
1579 | 1579 | figfile = str(self.specGraphPrefix.text()).strip() |
|
1580 | 1580 | |
|
1581 | 1581 | try: |
|
1582 | 1582 | wrperiod = int(str(self.specGgraphftpratio.text()).strip()) |
|
1583 | 1583 | except: |
|
1584 | 1584 | wrperiod = None |
|
1585 | 1585 | |
|
1586 | 1586 | #-----Spectra Plot----- |
|
1587 | 1587 | if self.specGraphCebSpectraplot.isChecked(): |
|
1588 | 1588 | |
|
1589 | 1589 | opObj = puObj.addOperation(name='SpectraPlot', optype='other') |
|
1590 | 1590 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1591 | 1591 | |
|
1592 | 1592 | if channelList: |
|
1593 | 1593 | |
|
1594 | 1594 | if not isList(channelList): |
|
1595 | 1595 | self.console.append("Invalid value [%s] for 'Graphic:ChannelList" %(channelList)) |
|
1596 | 1596 | return 0 |
|
1597 | 1597 | |
|
1598 | 1598 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1599 | 1599 | |
|
1600 | 1600 | if vel_range: |
|
1601 | 1601 | |
|
1602 | 1602 | if not isFloatRange(vel_range): |
|
1603 | 1603 | self.console.append("Invalid value [%s] for 'Graphic:Velocity-Range" %(vel_range)) |
|
1604 | 1604 | return 0 |
|
1605 | 1605 | |
|
1606 | 1606 | xvalueList = vel_range.split(',') |
|
1607 | 1607 | value1 = float(xvalueList[0]) |
|
1608 | 1608 | value2 = float(xvalueList[1]) |
|
1609 | 1609 | |
|
1610 | 1610 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1611 | 1611 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1612 | 1612 | |
|
1613 | 1613 | if hei_range: |
|
1614 | 1614 | |
|
1615 | 1615 | if not isFloatRange(hei_range): |
|
1616 | 1616 | self.console.append("Invalid value [%s] for 'Graphic:Height-Range" %(hei_range)) |
|
1617 | 1617 | return 0 |
|
1618 | 1618 | |
|
1619 | 1619 | yvalueList = hei_range.split(",") |
|
1620 | 1620 | value1 = float(yvalueList[0]) |
|
1621 | 1621 | value2 = float(yvalueList[1]) |
|
1622 | 1622 | |
|
1623 | 1623 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1624 | 1624 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1625 | 1625 | |
|
1626 | 1626 | if db_range: |
|
1627 | 1627 | |
|
1628 | 1628 | if not isFloatRange(db_range): |
|
1629 | 1629 | self.console.append("Invalid value [%s] for 'Graphic:dB-Range" %(db_range)) |
|
1630 | 1630 | return 0 |
|
1631 | 1631 | |
|
1632 | 1632 | zvalueList = db_range.split(",") |
|
1633 | 1633 | value1 = float(zvalueList[0]) |
|
1634 | 1634 | value2 = float(zvalueList[1]) |
|
1635 | 1635 | |
|
1636 | 1636 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1637 | 1637 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1638 | 1638 | |
|
1639 | 1639 | if self.specGraphSaveSpectra.isChecked(): |
|
1640 | 1640 | |
|
1641 | 1641 | checkPath = True |
|
1642 | 1642 | opObj.addParameter(name='save', value=1 , format='bool') |
|
1643 | 1643 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1644 | 1644 | if figfile: |
|
1645 | 1645 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1646 | 1646 | if wrperiod: |
|
1647 | 1647 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1648 | 1648 | |
|
1649 | 1649 | if self.specGraphftpSpectra.isChecked(): |
|
1650 | 1650 | |
|
1651 | 1651 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1652 | 1652 | self.addFTPConf2Operation(puObj, opObj) |
|
1653 | 1653 | addFTP = True |
|
1654 | 1654 | |
|
1655 | 1655 | if self.specGraphCebCrossSpectraplot.isChecked(): |
|
1656 | 1656 | |
|
1657 | 1657 | opObj = puObj.addOperation(name='CrossSpectraPlot', optype='other') |
|
1658 | 1658 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1659 | 1659 | |
|
1660 | 1660 | if vel_range: |
|
1661 | 1661 | |
|
1662 | 1662 | if not isFloatRange(vel_range): |
|
1663 | 1663 | self.console.append("Invalid value [%s] for 'Graphic:Velocity-Range" %(vel_range)) |
|
1664 | 1664 | return 0 |
|
1665 | 1665 | |
|
1666 | 1666 | xvalueList = vel_range.split(',') |
|
1667 | 1667 | value1 = float(xvalueList[0]) |
|
1668 | 1668 | value2 = float(xvalueList[1]) |
|
1669 | 1669 | |
|
1670 | 1670 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1671 | 1671 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1672 | 1672 | |
|
1673 | 1673 | if hei_range: |
|
1674 | 1674 | |
|
1675 | 1675 | if not isFloatRange(hei_range): |
|
1676 | 1676 | self.console.append("Invalid value [%s] for 'Graphic:Height-Range" %(hei_range)) |
|
1677 | 1677 | return 0 |
|
1678 | 1678 | |
|
1679 | 1679 | yvalueList = hei_range.split(",") |
|
1680 | 1680 | value1 = float(yvalueList[0]) |
|
1681 | 1681 | value2 = float(yvalueList[1]) |
|
1682 | 1682 | |
|
1683 | 1683 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1684 | 1684 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1685 | 1685 | |
|
1686 | 1686 | if db_range: |
|
1687 | 1687 | |
|
1688 | 1688 | if not isFloatRange(db_range): |
|
1689 | 1689 | self.console.append("Invalid value [%s] for 'Graphic:dB-Range" %(db_range)) |
|
1690 | 1690 | return 0 |
|
1691 | 1691 | |
|
1692 | 1692 | zvalueList = db_range.split(",") |
|
1693 | 1693 | value1 = float(zvalueList[0]) |
|
1694 | 1694 | value2 = float(zvalueList[1]) |
|
1695 | 1695 | |
|
1696 | 1696 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1697 | 1697 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1698 | 1698 | |
|
1699 | 1699 | if magrange: |
|
1700 | 1700 | |
|
1701 | 1701 | if not isFloatRange(magrange): |
|
1702 | 1702 | self.console.append("Invalid value [%s] for 'Graphic:Magnitud-Range" %(magrange)) |
|
1703 | 1703 | return 0 |
|
1704 | 1704 | |
|
1705 | 1705 | zvalueList = magrange.split(",") |
|
1706 | 1706 | value1 = float(zvalueList[0]) |
|
1707 | 1707 | value2 = float(zvalueList[1]) |
|
1708 | 1708 | |
|
1709 | 1709 | opObj.addParameter(name='coh_min', value=value1, format='float') |
|
1710 | 1710 | opObj.addParameter(name='coh_max', value=value2, format='float') |
|
1711 | 1711 | |
|
1712 | 1712 | if phaserange: |
|
1713 | 1713 | |
|
1714 | 1714 | if not isFloatRange(phaserange): |
|
1715 | 1715 | self.console.append("Invalid value [%s] for 'Graphic:Phase-Range" %(phaserange)) |
|
1716 | 1716 | return 0 |
|
1717 | 1717 | |
|
1718 | 1718 | zvalueList = phaserange.split(",") |
|
1719 | 1719 | value1 = float(zvalueList[0]) |
|
1720 | 1720 | value2 = float(zvalueList[1]) |
|
1721 | 1721 | |
|
1722 | 1722 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1723 | 1723 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1724 | 1724 | |
|
1725 | 1725 | if self.specGraphSaveCross.isChecked(): |
|
1726 | 1726 | checkPath = True |
|
1727 | 1727 | opObj.addParameter(name='save', value='1', format='bool') |
|
1728 | 1728 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1729 | 1729 | if figfile: |
|
1730 | 1730 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1731 | 1731 | if wrperiod: |
|
1732 | 1732 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1733 | 1733 | |
|
1734 | 1734 | if self.specGraphftpCross.isChecked(): |
|
1735 | 1735 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1736 | 1736 | self.addFTPConf2Operation(puObj, opObj) |
|
1737 | 1737 | addFTP = True |
|
1738 | 1738 | |
|
1739 | 1739 | if self.specGraphCebRTIplot.isChecked(): |
|
1740 | 1740 | |
|
1741 | 1741 | opObj = puObj.addOperation(name='RTIPlot', optype='other') |
|
1742 | 1742 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1743 | 1743 | |
|
1744 | 1744 | if channelList: |
|
1745 | 1745 | |
|
1746 | 1746 | if not isIntList(channelList): |
|
1747 | 1747 | self.console.append("Invalid value [%s] for 'Graphic:ChannelList" %(channelList)) |
|
1748 | 1748 | return 0 |
|
1749 | 1749 | |
|
1750 | 1750 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1751 | 1751 | |
|
1752 | 1752 | if trange: |
|
1753 | 1753 | |
|
1754 | 1754 | if not isFloatRange(trange): |
|
1755 | 1755 | self.console.append("Invalid value [%s] for 'Graphic:Time-Range" %(trange)) |
|
1756 | 1756 | return 0 |
|
1757 | 1757 | |
|
1758 | 1758 | zvalueList = trange.split(",") |
|
1759 | 1759 | value1 = float(zvalueList[0]) |
|
1760 | 1760 | value2 = float(zvalueList[1]) |
|
1761 | 1761 | |
|
1762 | 1762 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1763 | 1763 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1764 | ||
|
1765 | if timerange: | |
|
1766 | try: | |
|
1767 | timerange = int(timerange) | |
|
1768 | except: | |
|
1769 | return 0 | |
|
1770 | opObj.addParameter(name='timerange', value=timerange, format='int') | |
|
1764 | 1771 | |
|
1765 | 1772 | if hei_range: |
|
1766 | 1773 | |
|
1767 | 1774 | if not isFloatRange(hei_range): |
|
1768 | 1775 | self.console.append("Invalid value [%s] for 'Graphic:Height-Range" %(hei_range)) |
|
1769 | 1776 | return 0 |
|
1770 | 1777 | |
|
1771 | 1778 | yvalueList = hei_range.split(",") |
|
1772 | 1779 | value1 = float(yvalueList[0]) |
|
1773 | 1780 | value2 = float(yvalueList[1]) |
|
1774 | 1781 | |
|
1775 | 1782 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1776 | 1783 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1777 | 1784 | |
|
1778 | 1785 | if db_range: |
|
1779 | 1786 | |
|
1780 | 1787 | if not isFloatRange(db_range): |
|
1781 | 1788 | self.console.append("Invalid value [%s] for 'Graphic:dB-Range" %(db_range)) |
|
1782 | 1789 | return 0 |
|
1783 | 1790 | |
|
1784 | 1791 | zvalueList = db_range.split(",") |
|
1785 | 1792 | value1 = float(zvalueList[0]) |
|
1786 | 1793 | value2 = float(zvalueList[1]) |
|
1787 | 1794 | |
|
1788 | 1795 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1789 | 1796 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1790 | 1797 | |
|
1791 | 1798 | if self.specGraphSaveRTIplot.isChecked(): |
|
1792 | 1799 | checkPath = True |
|
1793 | 1800 | opObj.addParameter(name='save', value='1', format='bool') |
|
1794 | 1801 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1795 | 1802 | if figfile: |
|
1796 | 1803 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1797 | 1804 | if wrperiod: |
|
1798 | 1805 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1799 | 1806 | |
|
1800 | 1807 | if self.specGraphftpRTIplot.isChecked(): |
|
1801 | 1808 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1802 | 1809 | self.addFTPConf2Operation(puObj, opObj) |
|
1803 | 1810 | addFTP = True |
|
1804 | 1811 | |
|
1805 | 1812 | if self.specGraphCebCoherencmap.isChecked(): |
|
1806 | 1813 | |
|
1807 | 1814 | opObj = puObj.addOperation(name='CoherenceMap', optype='other') |
|
1808 | 1815 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1809 | 1816 | |
|
1810 | 1817 | if trange: |
|
1811 | 1818 | |
|
1812 | 1819 | if not isFloatRange(trange): |
|
1813 | 1820 | self.console.append("Invalid value [%s] for 'Graphic:Time-Range" %(trange)) |
|
1814 | 1821 | return 0 |
|
1815 | 1822 | |
|
1816 | 1823 | zvalueList = trange.split(",") |
|
1817 | 1824 | value1 = float(zvalueList[0]) |
|
1818 | 1825 | value2 = float(zvalueList[1]) |
|
1819 | 1826 | |
|
1820 | 1827 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1821 | 1828 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1822 | 1829 | |
|
1823 | 1830 | if hei_range: |
|
1824 | 1831 | |
|
1825 | 1832 | if not isFloatRange(hei_range): |
|
1826 | 1833 | self.console.append("Invalid value [%s] for 'Graphic:Height-Range" %(hei_range)) |
|
1827 | 1834 | return 0 |
|
1828 | 1835 | |
|
1829 | 1836 | yvalueList = hei_range.split(",") |
|
1830 | 1837 | value1 = float(yvalueList[0]) |
|
1831 | 1838 | value2 = float(yvalueList[1]) |
|
1832 | 1839 | |
|
1833 | 1840 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1834 | 1841 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1835 | 1842 | |
|
1836 | 1843 | if magrange: |
|
1837 | 1844 | |
|
1838 | 1845 | if not isFloatRange(magrange): |
|
1839 | 1846 | self.console.append("Invalid value [%s] for 'Graphic:Magnitud-Range" %(magrange)) |
|
1840 | 1847 | return 0 |
|
1841 | 1848 | |
|
1842 | 1849 | zvalueList = magrange.split(",") |
|
1843 | 1850 | value1 = float(zvalueList[0]) |
|
1844 | 1851 | value2 = float(zvalueList[1]) |
|
1845 | 1852 | |
|
1846 | 1853 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1847 | 1854 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1848 | 1855 | |
|
1849 | 1856 | if phaserange: |
|
1850 | 1857 | |
|
1851 | 1858 | if not isFloatRange(phaserange): |
|
1852 | 1859 | self.console.append("Invalid value [%s] for 'Graphic:Phase-Range" %(phaserange)) |
|
1853 | 1860 | return 0 |
|
1854 | 1861 | |
|
1855 | 1862 | zvalueList = phaserange.split(",") |
|
1856 | 1863 | value1 = float(zvalueList[0]) |
|
1857 | 1864 | value2 = float(zvalueList[1]) |
|
1858 | 1865 | |
|
1859 | 1866 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1860 | 1867 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1861 | 1868 | |
|
1862 | 1869 | if self.specGraphSaveCoherencemap.isChecked(): |
|
1863 | 1870 | checkPath = True |
|
1864 | 1871 | opObj.addParameter(name='save', value='1', format='bool') |
|
1865 | 1872 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1866 | 1873 | if figfile: |
|
1867 | 1874 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1868 | 1875 | if wrperiod: |
|
1869 | 1876 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1870 | 1877 | |
|
1871 | 1878 | if self.specGraphftpCoherencemap.isChecked(): |
|
1872 | 1879 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1873 | 1880 | self.addFTPConf2Operation(puObj, opObj) |
|
1874 | 1881 | addFTP = True |
|
1875 | 1882 | |
|
1876 | 1883 | if self.specGraphPowerprofile.isChecked(): |
|
1877 | 1884 | |
|
1878 | 1885 | opObj = puObj.addOperation(name='PowerProfilePlot', optype='other') |
|
1879 | 1886 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1880 | 1887 | |
|
1881 | 1888 | if channelList: |
|
1882 | 1889 | |
|
1883 | 1890 | if not isList(channelList): |
|
1884 | 1891 | self.console.append("Invalid value [%s] for 'Graphic:ChannelList" %(channelList)) |
|
1885 | 1892 | return 0 |
|
1886 | 1893 | |
|
1887 | 1894 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1888 | 1895 | |
|
1889 | 1896 | if hei_range: |
|
1890 | 1897 | |
|
1891 | 1898 | if not isFloatRange(hei_range): |
|
1892 | 1899 | self.console.append("Invalid value [%s] for 'Graphic:Height-Range" %(hei_range)) |
|
1893 | 1900 | return 0 |
|
1894 | 1901 | |
|
1895 | 1902 | yvalueList = hei_range.split(",") |
|
1896 | 1903 | value1 = float(yvalueList[0]) |
|
1897 | 1904 | value2 = float(yvalueList[1]) |
|
1898 | 1905 | |
|
1899 | 1906 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1900 | 1907 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1901 | 1908 | |
|
1902 | 1909 | if db_range: |
|
1903 | 1910 | |
|
1904 | 1911 | if not isFloatRange(db_range): |
|
1905 | 1912 | self.console.append("Invalid value [%s] for 'Graphic:dB-Range" %(db_range)) |
|
1906 | 1913 | return 0 |
|
1907 | 1914 | |
|
1908 | 1915 | zvalueList = db_range.split(",") |
|
1909 | 1916 | value1 = float(zvalueList[0]) |
|
1910 | 1917 | value2 = float(zvalueList[1]) |
|
1911 | 1918 | |
|
1912 | 1919 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1913 | 1920 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1914 | 1921 | |
|
1915 | 1922 | if self.specGraphSavePowerprofile.isChecked(): |
|
1916 | 1923 | checkPath = True |
|
1917 | 1924 | opObj.addParameter(name='save', value='1', format='bool') |
|
1918 | 1925 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1919 | 1926 | if figfile: |
|
1920 | 1927 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1921 | 1928 | if wrperiod: |
|
1922 | 1929 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1923 | 1930 | |
|
1924 | 1931 | if self.specGraphftpPowerprofile.isChecked(): |
|
1925 | 1932 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1926 | 1933 | self.addFTPConf2Operation(puObj, opObj) |
|
1927 | 1934 | addFTP = True |
|
1928 | 1935 | # rti noise |
|
1929 | 1936 | |
|
1930 | 1937 | if self.specGraphCebRTInoise.isChecked(): |
|
1931 | 1938 | |
|
1932 | 1939 | opObj = puObj.addOperation(name='Noise', optype='other') |
|
1933 | 1940 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1934 | 1941 | |
|
1935 | 1942 | if channelList: |
|
1936 | 1943 | |
|
1937 | 1944 | if not isList(channelList): |
|
1938 | 1945 | self.console.append("Invalid value [%s] for 'Graphic:ChannelList" %(channelList)) |
|
1939 | 1946 | return 0 |
|
1940 | 1947 | |
|
1941 | 1948 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1942 | 1949 | |
|
1943 | 1950 | if trange: |
|
1944 | 1951 | |
|
1945 | 1952 | if not isFloatRange(trange): |
|
1946 | 1953 | self.console.append("Invalid value [%s] for 'Graphic:Time-Range" %(trange)) |
|
1947 | 1954 | return 0 |
|
1948 | 1955 | |
|
1949 | 1956 | zvalueList = trange.split(",") |
|
1950 | 1957 | value1 = float(zvalueList[0]) |
|
1951 | 1958 | value2 = float(zvalueList[1]) |
|
1952 | 1959 | |
|
1953 | 1960 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1954 | 1961 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1955 | 1962 | |
|
1956 | 1963 | if db_range: |
|
1957 | 1964 | |
|
1958 | 1965 | if not isFloatRange(db_range): |
|
1959 | 1966 | self.console.append("Invalid value [%s] for 'Graphic:dB-Range" %(db_range)) |
|
1960 | 1967 | return 0 |
|
1961 | 1968 | |
|
1962 | 1969 | zvalueList = db_range.split(",") |
|
1963 | 1970 | value1 = float(zvalueList[0]) |
|
1964 | 1971 | value2 = float(zvalueList[1]) |
|
1965 | 1972 | |
|
1966 | 1973 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1967 | 1974 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1968 | 1975 | |
|
1969 | 1976 | if self.specGraphSaveRTInoise.isChecked(): |
|
1970 | 1977 | checkPath = True |
|
1971 | 1978 | opObj.addParameter(name='save', value='1', format='bool') |
|
1972 | 1979 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1973 | 1980 | if figfile: |
|
1974 | 1981 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1975 | 1982 | if wrperiod: |
|
1976 | 1983 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1977 | 1984 | |
|
1978 | 1985 | # test_ftp |
|
1979 | 1986 | if self.specGraphftpRTInoise.isChecked(): |
|
1980 | 1987 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1981 | 1988 | self.addFTPConf2Operation(puObj, opObj) |
|
1982 | 1989 | addFTP = True |
|
1983 | 1990 | |
|
1984 | 1991 | if checkPath: |
|
1985 | 1992 | if not figpath: |
|
1986 | 1993 | self.console.clear() |
|
1987 | 1994 | self.console.append("Graphic path should be defined") |
|
1988 | 1995 | return 0 |
|
1989 | 1996 | |
|
1990 | 1997 | if addFTP and not figpath: |
|
1991 | 1998 | self.console.clear() |
|
1992 | 1999 | self.console.append("You have to save the plots before sending them to FTP Server") |
|
1993 | 2000 | return 0 |
|
1994 | 2001 | |
|
1995 | 2002 | self.console.clear() |
|
1996 | 2003 | |
|
1997 | 2004 | # if something happend |
|
1998 | 2005 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Spectra') |
|
1999 | 2006 | if parms_ok: |
|
2000 | 2007 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') |
|
2001 | 2008 | opObj.addParameter(name='path', value=output_path) |
|
2002 | 2009 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') |
|
2003 | 2010 | |
|
2004 | 2011 | try: |
|
2005 | 2012 | self.refreshPUProperties(puObj) |
|
2006 | 2013 | except: |
|
2007 | 2014 | self.console.append("An error reading input parameters was found ... Check them!") |
|
2008 | 2015 | return 0 |
|
2009 | 2016 | |
|
2010 | 2017 | self.console.append("Save your project and press Play button to start signal processing") |
|
2011 | 2018 | |
|
2012 | 2019 | self._enable_play_button() |
|
2013 | 2020 | self._enable_save_button() |
|
2014 | 2021 | |
|
2015 | 2022 | return 1 |
|
2016 | 2023 | |
|
2017 | 2024 | |
|
2018 | 2025 | @pyqtSignature("") |
|
2019 | 2026 | def on_specGraphClear_clicked(self): |
|
2020 | 2027 | |
|
2021 | 2028 | self.console.clear() |
|
2022 | 2029 | |
|
2023 | 2030 | """ |
|
2024 | 2031 | Spectra Graph |
|
2025 | 2032 | """ |
|
2026 | 2033 | @pyqtSignature("int") |
|
2027 | 2034 | def on_specGraphCebSpectraplot_stateChanged(self, p0): |
|
2028 | 2035 | |
|
2029 | 2036 | self.__checkSpecGraphFilters() |
|
2030 | 2037 | |
|
2031 | 2038 | |
|
2032 | 2039 | @pyqtSignature("int") |
|
2033 | 2040 | def on_specGraphCebCrossSpectraplot_stateChanged(self, p0): |
|
2034 | 2041 | |
|
2035 | 2042 | self.__checkSpecGraphFilters() |
|
2036 | 2043 | |
|
2037 | 2044 | @pyqtSignature("int") |
|
2038 | 2045 | def on_specGraphCebRTIplot_stateChanged(self, p0): |
|
2039 | 2046 | |
|
2040 | 2047 | self.__checkSpecGraphFilters() |
|
2041 | 2048 | |
|
2042 | 2049 | |
|
2043 | 2050 | @pyqtSignature("int") |
|
2044 | 2051 | def on_specGraphCebRTInoise_stateChanged(self, p0): |
|
2045 | 2052 | |
|
2046 | 2053 | self.__checkSpecGraphFilters() |
|
2047 | 2054 | |
|
2048 | 2055 | |
|
2049 | 2056 | @pyqtSignature("int") |
|
2050 | 2057 | def on_specGraphCebCoherencmap_stateChanged(self, p0): |
|
2051 | 2058 | |
|
2052 | 2059 | self.__checkSpecGraphFilters() |
|
2053 | 2060 | |
|
2054 | 2061 | @pyqtSignature("int") |
|
2055 | 2062 | def on_specGraphPowerprofile_stateChanged(self, p0): |
|
2056 | 2063 | |
|
2057 | 2064 | self.__checkSpecGraphFilters() |
|
2058 | 2065 | |
|
2059 | 2066 | @pyqtSignature("int") |
|
2060 | 2067 | def on_specGraphPhase_stateChanged(self, p0): |
|
2061 | 2068 | |
|
2062 | 2069 | self.__checkSpecGraphFilters() |
|
2063 | 2070 | |
|
2064 | 2071 | @pyqtSignature("int") |
|
2065 | 2072 | def on_specGraphSaveSpectra_stateChanged(self, p0): |
|
2066 | 2073 | """ |
|
2067 | 2074 | """ |
|
2068 | 2075 | self.__checkSpecGraphSaving() |
|
2069 | 2076 | |
|
2070 | 2077 | @pyqtSignature("int") |
|
2071 | 2078 | def on_specGraphSaveCross_stateChanged(self, p0): |
|
2072 | 2079 | |
|
2073 | 2080 | self.__checkSpecGraphSaving() |
|
2074 | 2081 | |
|
2075 | 2082 | @pyqtSignature("int") |
|
2076 | 2083 | def on_specGraphSaveRTIplot_stateChanged(self, p0): |
|
2077 | 2084 | |
|
2078 | 2085 | self.__checkSpecGraphSaving() |
|
2079 | 2086 | |
|
2080 | 2087 | @pyqtSignature("int") |
|
2081 | 2088 | def on_specGraphSaveRTInoise_stateChanged(self, p0): |
|
2082 | 2089 | |
|
2083 | 2090 | self.__checkSpecGraphSaving() |
|
2084 | 2091 | |
|
2085 | 2092 | @pyqtSignature("int") |
|
2086 | 2093 | def on_specGraphSaveCoherencemap_stateChanged(self, p0): |
|
2087 | 2094 | |
|
2088 | 2095 | self.__checkSpecGraphSaving() |
|
2089 | 2096 | |
|
2090 | 2097 | @pyqtSignature("int") |
|
2091 | 2098 | def on_specGraphSavePowerprofile_stateChanged(self, p0): |
|
2092 | 2099 | |
|
2093 | 2100 | self.__checkSpecGraphSaving() |
|
2094 | 2101 | |
|
2095 | 2102 | @pyqtSignature("int") |
|
2096 | 2103 | def on_specGraphftpSpectra_stateChanged(self, p0): |
|
2097 | 2104 | """ |
|
2098 | 2105 | """ |
|
2099 | 2106 | self.__checkSpecGraphFTP() |
|
2100 | 2107 | |
|
2101 | 2108 | |
|
2102 | 2109 | @pyqtSignature("int") |
|
2103 | 2110 | def on_specGraphftpCross_stateChanged(self, p0): |
|
2104 | 2111 | |
|
2105 | 2112 | self.__checkSpecGraphFTP() |
|
2106 | 2113 | |
|
2107 | 2114 | @pyqtSignature("int") |
|
2108 | 2115 | def on_specGraphftpRTIplot_stateChanged(self, p0): |
|
2109 | 2116 | |
|
2110 | 2117 | self.__checkSpecGraphFTP() |
|
2111 | 2118 | |
|
2112 | 2119 | @pyqtSignature("int") |
|
2113 | 2120 | def on_specGraphftpRTInoise_stateChanged(self, p0): |
|
2114 | 2121 | |
|
2115 | 2122 | self.__checkSpecGraphFTP() |
|
2116 | 2123 | |
|
2117 | 2124 | @pyqtSignature("int") |
|
2118 | 2125 | def on_specGraphftpCoherencemap_stateChanged(self, p0): |
|
2119 | 2126 | |
|
2120 | 2127 | self.__checkSpecGraphFTP() |
|
2121 | 2128 | |
|
2122 | 2129 | @pyqtSignature("int") |
|
2123 | 2130 | def on_specGraphftpPowerprofile_stateChanged(self, p0): |
|
2124 | 2131 | |
|
2125 | 2132 | self.__checkSpecGraphFTP() |
|
2126 | 2133 | |
|
2127 | 2134 | @pyqtSignature("") |
|
2128 | 2135 | def on_specGraphToolPath_clicked(self): |
|
2129 | 2136 | """ |
|
2130 | 2137 | """ |
|
2131 | 2138 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
2132 | 2139 | self.specGraphPath.setText(save_path) |
|
2133 | 2140 | if not os.path.exists(save_path): |
|
2134 | 2141 | self.console.clear() |
|
2135 | 2142 | self.console.append("Write a valid path") |
|
2136 | 2143 | return |
|
2137 | 2144 | |
|
2138 | 2145 | @pyqtSignature("") |
|
2139 | 2146 | def on_specHeisGraphToolPath_clicked(self): |
|
2140 | 2147 | """ |
|
2141 | 2148 | """ |
|
2142 | 2149 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
2143 | 2150 | self.specHeisGraphPath.setText(save_path) |
|
2144 | 2151 | if not os.path.exists(save_path): |
|
2145 | 2152 | self.console.clear() |
|
2146 | 2153 | self.console.append("Write a valid path") |
|
2147 | 2154 | return |
|
2148 | 2155 | |
|
2149 | 2156 | @pyqtSignature("int") |
|
2150 | 2157 | def on_specHeisOpCebIncoherent_stateChanged(self, p0): |
|
2151 | 2158 | """ |
|
2152 | 2159 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
2153 | 2160 | """ |
|
2154 | 2161 | if p0 == 2: |
|
2155 | 2162 | self.specHeisOpIncoherent.setEnabled(True) |
|
2156 | 2163 | self.specHeisOpCobIncInt.setEnabled(True) |
|
2157 | 2164 | if p0 == 0: |
|
2158 | 2165 | self.specHeisOpIncoherent.setEnabled(False) |
|
2159 | 2166 | self.specHeisOpCobIncInt.setEnabled(False) |
|
2160 | 2167 | |
|
2161 | 2168 | @pyqtSignature("") |
|
2162 | 2169 | def on_specHeisOpOk_clicked(self): |
|
2163 | 2170 | """ |
|
2164 | 2171 | AΓADE OPERACION SPECTRAHEIS |
|
2165 | 2172 | """ |
|
2166 | 2173 | addFTP = False |
|
2167 | 2174 | checkPath = False |
|
2168 | 2175 | |
|
2169 | 2176 | self._disable_play_button() |
|
2170 | 2177 | self._disable_save_button() |
|
2171 | 2178 | |
|
2172 | 2179 | self.console.clear() |
|
2173 | 2180 | self.console.append("Checking input parameters ...") |
|
2174 | 2181 | |
|
2175 | 2182 | puObj = self.getSelectedItemObj() |
|
2176 | 2183 | puObj.removeOperations() |
|
2177 | 2184 | |
|
2178 | 2185 | if self.specHeisOpCebIncoherent.isChecked(): |
|
2179 | 2186 | value = str(self.specHeisOpIncoherent.text()) |
|
2180 | 2187 | name_operation = 'IncohInt4SpectraHeis' |
|
2181 | 2188 | optype = 'other' |
|
2182 | 2189 | |
|
2183 | 2190 | name_parameter = 'timeInterval' |
|
2184 | 2191 | format = 'float' |
|
2185 | 2192 | |
|
2186 | 2193 | if self.specOpCobIncInt.currentIndex() == 0: |
|
2187 | 2194 | name_parameter = 'timeInterval' |
|
2188 | 2195 | format = 'float' |
|
2189 | 2196 | |
|
2190 | 2197 | if not isFloat(value): |
|
2191 | 2198 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2192 | 2199 | return 0 |
|
2193 | 2200 | |
|
2194 | 2201 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2195 | 2202 | |
|
2196 | 2203 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
2197 | 2204 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2198 | 2205 | return 0 |
|
2199 | 2206 | |
|
2200 | 2207 | channelList = str(self.specHeisGgraphChannelList.text()) |
|
2201 | 2208 | freq_range = str(self.specHeisGgraphXminXmax.text()) |
|
2202 | 2209 | power_range = str(self.specHeisGgraphYminYmax.text()) |
|
2203 | 2210 | time_range = str(self.specHeisGgraphTminTmax.text()) |
|
2204 | 2211 | timerange = str(self.specHeisGgraphTimeRange.text()) |
|
2205 | 2212 | |
|
2206 | 2213 | if self.specHeisGraphCebSpectraplot.isChecked(): |
|
2207 | 2214 | |
|
2208 | 2215 | name_operation = 'SpectraHeisScope' |
|
2209 | 2216 | optype = 'other' |
|
2210 | 2217 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2211 | 2218 | |
|
2212 | 2219 | name_parameter = 'id' |
|
2213 | 2220 | format = 'int' |
|
2214 | 2221 | value = opObj.id |
|
2215 | 2222 | |
|
2216 | 2223 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
2217 | 2224 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2218 | 2225 | return 0 |
|
2219 | 2226 | |
|
2220 | 2227 | if not (channelList == ''): |
|
2221 | 2228 | name_parameter = 'channelList' |
|
2222 | 2229 | format = 'intlist' |
|
2223 | 2230 | |
|
2224 | 2231 | if not isList(channelList): |
|
2225 | 2232 | self.console.append("Invalid value '%s' for '%s'" %(channelList, name_parameter)) |
|
2226 | 2233 | return 0 |
|
2227 | 2234 | |
|
2228 | 2235 | opObj.addParameter(name=name_parameter, value=channelList, format=format) |
|
2229 | 2236 | |
|
2230 | 2237 | if not freq_range == '': |
|
2231 | 2238 | xvalueList = freq_range.split(',') |
|
2232 | 2239 | |
|
2233 | 2240 | if len(xvalueList) != 2: |
|
2234 | 2241 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) |
|
2235 | 2242 | return 0 |
|
2236 | 2243 | |
|
2237 | 2244 | value1 = xvalueList[0] |
|
2238 | 2245 | value2 = xvalueList[1] |
|
2239 | 2246 | |
|
2240 | 2247 | if not isFloat(value1) or not isFloat(value2): |
|
2241 | 2248 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) |
|
2242 | 2249 | return 0 |
|
2243 | 2250 | |
|
2244 | 2251 | name1 = 'xmin' |
|
2245 | 2252 | name2 = 'xmax' |
|
2246 | 2253 | format = 'float' |
|
2247 | 2254 | |
|
2248 | 2255 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2249 | 2256 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2250 | 2257 | |
|
2251 | 2258 | if not power_range == '': |
|
2252 | 2259 | yvalueList = power_range.split(",") |
|
2253 | 2260 | |
|
2254 | 2261 | if len(yvalueList) != 2: |
|
2255 | 2262 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "xrange")) |
|
2256 | 2263 | return 0 |
|
2257 | 2264 | |
|
2258 | 2265 | value1 = yvalueList[0] |
|
2259 | 2266 | value2 = yvalueList[1] |
|
2260 | 2267 | |
|
2261 | 2268 | if not isFloat(value1) or not isFloat(value2): |
|
2262 | 2269 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "yrange")) |
|
2263 | 2270 | return 0 |
|
2264 | 2271 | |
|
2265 | 2272 | name1 = 'ymin' |
|
2266 | 2273 | name2 = 'ymax' |
|
2267 | 2274 | format = 'float' |
|
2268 | 2275 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2269 | 2276 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2270 | 2277 | |
|
2271 | 2278 | if self.specHeisGraphSaveSpectra.isChecked(): |
|
2272 | 2279 | checkPath = True |
|
2273 | 2280 | name_parameter1 = 'save' |
|
2274 | 2281 | name_parameter2 = 'figpath' |
|
2275 | 2282 | name_parameter3 = 'figfile' |
|
2276 | 2283 | value1 = '1' |
|
2277 | 2284 | value2 = str(self.specHeisGraphPath.text()) |
|
2278 | 2285 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2279 | 2286 | format1 = 'bool' |
|
2280 | 2287 | format2 = 'str' |
|
2281 | 2288 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) |
|
2282 | 2289 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2283 | 2290 | if not value3 == "": |
|
2284 | 2291 | try: |
|
2285 | 2292 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2286 | 2293 | except: |
|
2287 | 2294 | self.console.clear() |
|
2288 | 2295 | self.console.append("Please Write prefix") |
|
2289 | 2296 | return 0 |
|
2290 | 2297 | opObj.addParameter(name='figfile', value=str(self.specHeisGraphPrefix.text()), format='str') |
|
2291 | 2298 | |
|
2292 | 2299 | # opObj.addParameter(name=name_parameter3, value=value3, format=format2) |
|
2293 | 2300 | # opObj.addParameter(name='wr_period', value='5',format='int') |
|
2294 | 2301 | |
|
2295 | 2302 | if self.specHeisGraphftpSpectra.isChecked(): |
|
2296 | 2303 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2297 | 2304 | self.addFTPConf2Operation(puObj, opObj) |
|
2298 | 2305 | addFTP = True |
|
2299 | 2306 | |
|
2300 | 2307 | if self.specHeisGraphCebRTIplot.isChecked(): |
|
2301 | 2308 | name_operation = 'RTIfromSpectraHeis' |
|
2302 | 2309 | optype = 'other' |
|
2303 | 2310 | |
|
2304 | 2311 | name_parameter = 'id' |
|
2305 | 2312 | format = 'int' |
|
2306 | 2313 | |
|
2307 | 2314 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2308 | 2315 | value = opObj.id |
|
2309 | 2316 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
2310 | 2317 | |
|
2311 | 2318 | if not channelList == '': |
|
2312 | 2319 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
2313 | 2320 | |
|
2314 | 2321 | if not time_range == '': |
|
2315 | 2322 | xvalueList = time_range.split(',') |
|
2316 | 2323 | try: |
|
2317 | 2324 | value = float(xvalueList[0]) |
|
2318 | 2325 | value = float(xvalueList[1]) |
|
2319 | 2326 | except: |
|
2320 | 2327 | return 0 |
|
2321 | 2328 | format = 'float' |
|
2322 | 2329 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) |
|
2323 | 2330 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) |
|
2324 | 2331 | |
|
2325 | 2332 | if not timerange == '': |
|
2326 | 2333 | format = 'int' |
|
2327 | 2334 | try: |
|
2328 | 2335 | timerange = int(timerange) |
|
2329 | 2336 | except: |
|
2330 | 2337 | return 0 |
|
2331 | 2338 | opObj.addParameter(name='timerange', value=timerange, format=format) |
|
2332 | 2339 | |
|
2333 | 2340 | |
|
2334 | 2341 | if not power_range == '': |
|
2335 | 2342 | yvalueList = power_range.split(",") |
|
2336 | 2343 | try: |
|
2337 | 2344 | value = float(yvalueList[0]) |
|
2338 | 2345 | value = float(yvalueList[1]) |
|
2339 | 2346 | except: |
|
2340 | 2347 | return 0 |
|
2341 | 2348 | |
|
2342 | 2349 | format = 'float' |
|
2343 | 2350 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) |
|
2344 | 2351 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) |
|
2345 | 2352 | |
|
2346 | 2353 | if self.specHeisGraphSaveRTIplot.isChecked(): |
|
2347 | 2354 | checkPath = True |
|
2348 | 2355 | opObj.addParameter(name='save', value='1', format='bool') |
|
2349 | 2356 | opObj.addParameter(name='figpath', value=str(self.specHeisGraphPath.text()), format='str') |
|
2350 | 2357 | value = str(self.specHeisGraphPrefix.text()) |
|
2351 | 2358 | if not value == "": |
|
2352 | 2359 | try: |
|
2353 | 2360 | value = str(self.specHeisGraphPrefix.text()) |
|
2354 | 2361 | except: |
|
2355 | 2362 | self.console.clear() |
|
2356 | 2363 | self.console.append("Please Write prefix") |
|
2357 | 2364 | return 0 |
|
2358 | 2365 | opObj.addParameter(name='figfile', value=value, format='str') |
|
2359 | 2366 | |
|
2360 | 2367 | # test_ftp |
|
2361 | 2368 | if self.specHeisGraphftpRTIplot.isChecked(): |
|
2362 | 2369 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2363 | 2370 | self.addFTPConf2Operation(puObj, opObj) |
|
2364 | 2371 | addFTP = True |
|
2365 | 2372 | |
|
2366 | 2373 | localfolder = None |
|
2367 | 2374 | if checkPath: |
|
2368 | 2375 | localfolder = str(self.specHeisGraphPath.text()) |
|
2369 | 2376 | if localfolder == '': |
|
2370 | 2377 | self.console.clear() |
|
2371 | 2378 | self.console.append("Graphic path should be defined") |
|
2372 | 2379 | return 0 |
|
2373 | 2380 | |
|
2374 | 2381 | if addFTP and not localfolder: |
|
2375 | 2382 | self.console.clear() |
|
2376 | 2383 | self.console.append("You should save plots before send them to FTP Server") |
|
2377 | 2384 | return 0 |
|
2378 | 2385 | |
|
2379 | 2386 | # if something happened |
|
2380 | 2387 | parms_ok, output_path, blocksperfile, metadata_file = self.checkInputsPUSave(datatype='SpectraHeis') |
|
2381 | 2388 | if parms_ok: |
|
2382 | 2389 | name_operation = 'FitsWriter' |
|
2383 | 2390 | optype = 'other' |
|
2384 | 2391 | name_parameter1 = 'path' |
|
2385 | 2392 | name_parameter2 = 'dataBlocksPerFile' |
|
2386 | 2393 | name_parameter3 = 'metadatafile' |
|
2387 | 2394 | value1 = output_path |
|
2388 | 2395 | value2 = blocksperfile |
|
2389 | 2396 | value3 = metadata_file |
|
2390 | 2397 | format2 = "int" |
|
2391 | 2398 | format3 = "str" |
|
2392 | 2399 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2393 | 2400 | |
|
2394 | 2401 | opObj.addParameter(name=name_parameter1, value=value1) |
|
2395 | 2402 | |
|
2396 | 2403 | if blocksperfile: |
|
2397 | 2404 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2398 | 2405 | |
|
2399 | 2406 | if metadata_file: |
|
2400 | 2407 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) |
|
2401 | 2408 | |
|
2402 | 2409 | self.console.clear() |
|
2403 | 2410 | try: |
|
2404 | 2411 | self.refreshPUProperties(puObj) |
|
2405 | 2412 | except: |
|
2406 | 2413 | self.console.append("An error reading input parameters was found ... Check them!") |
|
2407 | 2414 | return 0 |
|
2408 | 2415 | |
|
2409 | 2416 | self.console.append("Save your project and press Play button to start signal processing") |
|
2410 | 2417 | |
|
2411 | 2418 | self._enable_save_button() |
|
2412 | 2419 | self._enable_play_button() |
|
2413 | 2420 | |
|
2414 | 2421 | return 1 |
|
2415 | 2422 | |
|
2416 | 2423 | @pyqtSignature("") |
|
2417 | 2424 | def on_specHeisGraphClear_clicked(self): |
|
2418 | 2425 | |
|
2419 | 2426 | self.console.clear() |
|
2420 | 2427 | |
|
2421 | 2428 | @pyqtSignature("int") |
|
2422 | 2429 | def on_specHeisGraphCebSpectraplot_stateChanged(self, p0): |
|
2423 | 2430 | |
|
2424 | 2431 | if p0 == 2: |
|
2425 | 2432 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2426 | 2433 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
2427 | 2434 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2428 | 2435 | if p0 == 0: |
|
2429 | 2436 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
2430 | 2437 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2431 | 2438 | |
|
2432 | 2439 | @pyqtSignature("int") |
|
2433 | 2440 | def on_specHeisGraphCebRTIplot_stateChanged(self, p0): |
|
2434 | 2441 | |
|
2435 | 2442 | if p0 == 2: |
|
2436 | 2443 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2437 | 2444 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
2438 | 2445 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2439 | 2446 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
2440 | 2447 | |
|
2441 | 2448 | if p0 == 0: |
|
2442 | 2449 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
2443 | 2450 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2444 | 2451 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
2445 | 2452 | |
|
2446 | 2453 | @pyqtSignature("int") |
|
2447 | 2454 | def on_specHeisGraphSaveSpectra_stateChanged(self, p0): |
|
2448 | 2455 | """ |
|
2449 | 2456 | """ |
|
2450 | 2457 | if p0 == 2: |
|
2451 | 2458 | self.specHeisGraphPath.setEnabled(True) |
|
2452 | 2459 | self.specHeisGraphPrefix.setEnabled(True) |
|
2453 | 2460 | self.specHeisGraphToolPath.setEnabled(True) |
|
2454 | 2461 | if p0 == 0: |
|
2455 | 2462 | self.specHeisGraphPath.setEnabled(False) |
|
2456 | 2463 | self.specHeisGraphPrefix.setEnabled(False) |
|
2457 | 2464 | self.specHeisGraphToolPath.setEnabled(False) |
|
2458 | 2465 | |
|
2459 | 2466 | @pyqtSignature("int") |
|
2460 | 2467 | def on_specHeisGraphSaveRTIplot_stateChanged(self, p0): |
|
2461 | 2468 | if p0 == 2: |
|
2462 | 2469 | self.specHeisGraphPath.setEnabled(True) |
|
2463 | 2470 | self.specHeisGraphPrefix.setEnabled(True) |
|
2464 | 2471 | self.specHeisGraphToolPath.setEnabled(True) |
|
2465 | 2472 | |
|
2466 | 2473 | @pyqtSignature("int") |
|
2467 | 2474 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): |
|
2468 | 2475 | """ |
|
2469 | 2476 | """ |
|
2470 | 2477 | if p0 == 2: |
|
2471 | 2478 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2472 | 2479 | |
|
2473 | 2480 | if p0 == 0: |
|
2474 | 2481 | self.specHeisGgraphftpratio.setEnabled(False) |
|
2475 | 2482 | |
|
2476 | 2483 | @pyqtSignature("int") |
|
2477 | 2484 | def on_specHeisGraphftpRTIplot_stateChanged(self, p0): |
|
2478 | 2485 | if p0 == 2: |
|
2479 | 2486 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2480 | 2487 | |
|
2481 | 2488 | def __checkSpecGraphSaving(self): |
|
2482 | 2489 | |
|
2483 | 2490 | enable = False |
|
2484 | 2491 | |
|
2485 | 2492 | if self.specGraphSaveSpectra.checkState(): |
|
2486 | 2493 | enable = True |
|
2487 | 2494 | |
|
2488 | 2495 | if self.specGraphSaveCross.checkState(): |
|
2489 | 2496 | enable = True |
|
2490 | 2497 | |
|
2491 | 2498 | if self.specGraphSaveRTIplot.checkState(): |
|
2492 | 2499 | enable = True |
|
2493 | 2500 | |
|
2494 | 2501 | if self.specGraphSaveCoherencemap.checkState(): |
|
2495 | 2502 | enable = True |
|
2496 | 2503 | |
|
2497 | 2504 | if self.specGraphSavePowerprofile.checkState(): |
|
2498 | 2505 | enable = True |
|
2499 | 2506 | |
|
2500 | 2507 | if self.specGraphSaveRTInoise.checkState(): |
|
2501 | 2508 | enable = True |
|
2502 | 2509 | |
|
2503 | 2510 | self.specGraphPath.setEnabled(enable) |
|
2504 | 2511 | self.specGraphPrefix.setEnabled(enable) |
|
2505 | 2512 | self.specGraphToolPath.setEnabled(enable) |
|
2506 | 2513 | |
|
2507 | 2514 | self.specGgraphftpratio.setEnabled(enable) |
|
2508 | 2515 | |
|
2509 | 2516 | def __checkSpecGraphFTP(self): |
|
2510 | 2517 | |
|
2511 | 2518 | enable = False |
|
2512 | 2519 | |
|
2513 | 2520 | if self.specGraphftpSpectra.checkState(): |
|
2514 | 2521 | enable = True |
|
2515 | 2522 | |
|
2516 | 2523 | if self.specGraphftpCross.checkState(): |
|
2517 | 2524 | enable = True |
|
2518 | 2525 | |
|
2519 | 2526 | if self.specGraphftpRTIplot.checkState(): |
|
2520 | 2527 | enable = True |
|
2521 | 2528 | |
|
2522 | 2529 | if self.specGraphftpCoherencemap.checkState(): |
|
2523 | 2530 | enable = True |
|
2524 | 2531 | |
|
2525 | 2532 | if self.specGraphftpPowerprofile.checkState(): |
|
2526 | 2533 | enable = True |
|
2527 | 2534 | |
|
2528 | 2535 | if self.specGraphftpRTInoise.checkState(): |
|
2529 | 2536 | enable = True |
|
2530 | 2537 | |
|
2531 | 2538 | # self.specGgraphftpratio.setEnabled(enable) |
|
2532 | 2539 | |
|
2533 | 2540 | def __checkSpecGraphFilters(self): |
|
2534 | 2541 | |
|
2535 | 2542 | freq = False |
|
2536 | 2543 | height = False |
|
2537 | 2544 | db = False |
|
2538 | 2545 | timerange = False |
|
2539 | 2546 | magnitud = False |
|
2540 | 2547 | phase = False |
|
2541 | 2548 | channelList = False |
|
2542 | 2549 | |
|
2543 | 2550 | if self.specGraphCebSpectraplot.checkState(): |
|
2544 | 2551 | freq = True |
|
2545 | 2552 | height = True |
|
2546 | 2553 | db = True |
|
2547 | 2554 | channelList = True |
|
2548 | 2555 | |
|
2549 | 2556 | if self.specGraphCebCrossSpectraplot.checkState(): |
|
2550 | 2557 | freq = True |
|
2551 | 2558 | height = True |
|
2552 | 2559 | db = True |
|
2553 | 2560 | magnitud = True |
|
2554 | 2561 | phase = True |
|
2555 | 2562 | |
|
2556 | 2563 | if self.specGraphCebRTIplot.checkState(): |
|
2557 | 2564 | height = True |
|
2558 | 2565 | db = True |
|
2559 | 2566 | timerange = True |
|
2560 | 2567 | channelList = True |
|
2561 | 2568 | |
|
2562 | 2569 | if self.specGraphCebCoherencmap.checkState(): |
|
2563 | 2570 | height = True |
|
2564 | 2571 | timerange = True |
|
2565 | 2572 | magnitud = True |
|
2566 | 2573 | phase = True |
|
2567 | 2574 | |
|
2568 | 2575 | if self.specGraphPowerprofile.checkState(): |
|
2569 | 2576 | height = True |
|
2570 | 2577 | db = True |
|
2571 | 2578 | channelList = True |
|
2572 | 2579 | |
|
2573 | 2580 | if self.specGraphCebRTInoise.checkState(): |
|
2574 | 2581 | db = True |
|
2575 | 2582 | timerange = True |
|
2576 | 2583 | channelList = True |
|
2577 | 2584 | |
|
2578 | 2585 | |
|
2579 | 2586 | self.specGgraphFreq.setEnabled(freq) |
|
2580 | 2587 | self.specGgraphHeight.setEnabled(height) |
|
2581 | 2588 | self.specGgraphDbsrange.setEnabled(db) |
|
2582 | 2589 | self.specGgraphTminTmax.setEnabled(timerange) |
|
2590 | self.specGgraphTimeRange.setEnabled(timerange) | |
|
2583 | 2591 | |
|
2584 | 2592 | self.specGgraphmagnitud.setEnabled(magnitud) |
|
2585 | 2593 | self.specGgraphPhase.setEnabled(phase) |
|
2586 | 2594 | self.specGgraphChannelList.setEnabled(channelList) |
|
2587 | 2595 | |
|
2588 | 2596 | def __getParmsFromProjectWindow(self): |
|
2589 | 2597 | """ |
|
2590 | 2598 | Check Inputs Project: |
|
2591 | 2599 | - project_name |
|
2592 | 2600 | - datatype |
|
2593 | 2601 | - ext |
|
2594 | 2602 | - data_path |
|
2595 | 2603 | - readmode |
|
2596 | 2604 | - delay |
|
2597 | 2605 | - set |
|
2598 | 2606 | - walk |
|
2599 | 2607 | """ |
|
2600 | 2608 | parms_ok = True |
|
2601 | 2609 | |
|
2602 | 2610 | project_name = str(self.proName.text()) |
|
2603 | 2611 | |
|
2604 | 2612 | if project_name == '' or project_name == None: |
|
2605 | 2613 | outputstr = "Enter a project Name" |
|
2606 | 2614 | self.console.append(outputstr) |
|
2607 | 2615 | parms_ok = False |
|
2608 | 2616 | project_name = None |
|
2609 | 2617 | |
|
2610 | 2618 | description = str(self.proDescription.toPlainText()) |
|
2611 | 2619 | |
|
2612 | 2620 | datatype = str(self.proComDataType.currentText()) |
|
2613 | 2621 | |
|
2614 | 2622 | ext = str(self.proDataType.text()) |
|
2615 | 2623 | |
|
2616 | 2624 | dpath = str(self.proDataPath.text()) |
|
2617 | 2625 | |
|
2618 | 2626 | if dpath == '': |
|
2619 | 2627 | outputstr = 'Datapath is empty' |
|
2620 | 2628 | self.console.append(outputstr) |
|
2621 | 2629 | parms_ok = False |
|
2622 | 2630 | dpath = None |
|
2623 | 2631 | |
|
2624 | 2632 | if dpath != None: |
|
2625 | 2633 | if not os.path.isdir(dpath): |
|
2626 | 2634 | outputstr = 'Datapath (%s) does not exist' % dpath |
|
2627 | 2635 | self.console.append(outputstr) |
|
2628 | 2636 | parms_ok = False |
|
2629 | 2637 | dpath = None |
|
2630 | 2638 | |
|
2631 | 2639 | online = int(self.proComReadMode.currentIndex()) |
|
2632 | 2640 | |
|
2633 | 2641 | delay = None |
|
2634 | 2642 | if online==1: |
|
2635 | 2643 | try: |
|
2636 | 2644 | delay = int(str(self.proDelay.text())) |
|
2637 | 2645 | except: |
|
2638 | 2646 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proDelay.text()) |
|
2639 | 2647 | self.console.append(outputstr) |
|
2640 | 2648 | parms_ok = False |
|
2641 | 2649 | |
|
2642 | 2650 | |
|
2643 | 2651 | set = None |
|
2644 | 2652 | value = str(self.proSet.text()) |
|
2645 | 2653 | try: |
|
2646 | 2654 | set = int(value) |
|
2647 | 2655 | except: |
|
2648 | 2656 | pass |
|
2649 | 2657 | |
|
2650 | 2658 | ippKm = None |
|
2651 | 2659 | |
|
2652 | 2660 | value = str(self.proIPPKm.text()) |
|
2653 | 2661 | |
|
2654 | 2662 | try: |
|
2655 | 2663 | ippKm = float(value) |
|
2656 | 2664 | except: |
|
2657 | 2665 | if datatype=="USRP": |
|
2658 | 2666 | outputstr = 'IPP value "%s" must be a float number' % str(self.proIPPKm.text()) |
|
2659 | 2667 | self.console.append(outputstr) |
|
2660 | 2668 | parms_ok = False |
|
2661 | 2669 | |
|
2662 | 2670 | walk = int(self.proComWalk.currentIndex()) |
|
2663 | 2671 | expLabel = str(self.proExpLabel.text()) |
|
2664 | 2672 | |
|
2665 | 2673 | startDate = str(self.proComStartDate.currentText()).strip() |
|
2666 | 2674 | endDate = str(self.proComEndDate.currentText()).strip() |
|
2667 | 2675 | |
|
2668 | 2676 | if not startDate: |
|
2669 | 2677 | parms_ok = False |
|
2670 | 2678 | |
|
2671 | 2679 | if not endDate: |
|
2672 | 2680 | parms_ok = False |
|
2673 | 2681 | |
|
2674 | 2682 | # startDateList = startDate.split("/") |
|
2675 | 2683 | # endDateList = endDate.split("/") |
|
2676 | 2684 | # |
|
2677 | 2685 | # startDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) |
|
2678 | 2686 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) |
|
2679 | 2687 | |
|
2680 | 2688 | startTime = self.proStartTime.time() |
|
2681 | 2689 | endTime = self.proEndTime.time() |
|
2682 | 2690 | |
|
2683 | 2691 | startTime = str(startTime.toString("H:m:s")) |
|
2684 | 2692 | endTime = str(endTime.toString("H:m:s")) |
|
2685 | 2693 | |
|
2686 | 2694 | projectParms = ProjectParms() |
|
2687 | 2695 | |
|
2688 | 2696 | projectParms.name = project_name |
|
2689 | 2697 | projectParms.description = description |
|
2690 | 2698 | projectParms.datatype = datatype |
|
2691 | 2699 | projectParms.ext = ext |
|
2692 | 2700 | projectParms.dpath = dpath |
|
2693 | 2701 | projectParms.online = online |
|
2694 | 2702 | projectParms.startDate = startDate |
|
2695 | 2703 | projectParms.endDate = endDate |
|
2696 | 2704 | projectParms.startTime = startTime |
|
2697 | 2705 | projectParms.endTime = endTime |
|
2698 | 2706 | projectParms.delay = delay |
|
2699 | 2707 | projectParms.walk = walk |
|
2700 | 2708 | projectParms.expLabel = expLabel |
|
2701 | 2709 | projectParms.set = set |
|
2702 | 2710 | projectParms.ippKm = ippKm |
|
2703 | 2711 | projectParms.parmsOk = parms_ok |
|
2704 | 2712 | |
|
2705 | 2713 | return projectParms |
|
2706 | 2714 | |
|
2707 | 2715 | |
|
2708 | 2716 | def __getParmsFromProjectObj(self, projectObjView): |
|
2709 | 2717 | |
|
2710 | 2718 | parms_ok = True |
|
2711 | 2719 | |
|
2712 | 2720 | project_name, description = projectObjView.name, projectObjView.description |
|
2713 | 2721 | |
|
2714 | 2722 | readUnitObj = projectObjView.getReadUnitObj() |
|
2715 | 2723 | datatype = readUnitObj.datatype |
|
2716 | 2724 | |
|
2717 | 2725 | operationObj = readUnitObj.getOperationObj(name='run') |
|
2718 | 2726 | |
|
2719 | 2727 | dpath = operationObj.getParameterValue(parameterName='path') |
|
2720 | 2728 | startDate = operationObj.getParameterValue(parameterName='startDate') |
|
2721 | 2729 | endDate = operationObj.getParameterValue(parameterName='endDate') |
|
2722 | 2730 | |
|
2723 | 2731 | startDate = startDate.strftime("%Y/%m/%d") |
|
2724 | 2732 | endDate = endDate.strftime("%Y/%m/%d") |
|
2725 | 2733 | |
|
2726 | 2734 | startTime = operationObj.getParameterValue(parameterName='startTime') |
|
2727 | 2735 | endTime = operationObj.getParameterValue(parameterName='endTime') |
|
2728 | 2736 | |
|
2729 | 2737 | startTime = startTime.strftime("%H:%M:%S") |
|
2730 | 2738 | endTime = endTime.strftime("%H:%M:%S") |
|
2731 | 2739 | |
|
2732 | 2740 | online = 0 |
|
2733 | 2741 | try: |
|
2734 | 2742 | online = operationObj.getParameterValue(parameterName='online') |
|
2735 | 2743 | except: |
|
2736 | 2744 | pass |
|
2737 | 2745 | |
|
2738 | 2746 | delay = '' |
|
2739 | 2747 | try: |
|
2740 | 2748 | delay = operationObj.getParameterValue(parameterName='delay') |
|
2741 | 2749 | except: |
|
2742 | 2750 | pass |
|
2743 | 2751 | |
|
2744 | 2752 | walk = 0 |
|
2745 | 2753 | try: |
|
2746 | 2754 | walk = operationObj.getParameterValue(parameterName='walk') |
|
2747 | 2755 | except: |
|
2748 | 2756 | pass |
|
2749 | 2757 | |
|
2750 | 2758 | set = '' |
|
2751 | 2759 | try: |
|
2752 | 2760 | set = operationObj.getParameterValue(parameterName='set') |
|
2753 | 2761 | except: |
|
2754 | 2762 | pass |
|
2755 | 2763 | |
|
2756 | 2764 | expLabel = '' |
|
2757 | 2765 | try: |
|
2758 | 2766 | expLabel = operationObj.getParameterValue(parameterName='expLabel') |
|
2759 | 2767 | except: |
|
2760 | 2768 | pass |
|
2761 | 2769 | |
|
2762 | 2770 | ippKm = '' |
|
2763 | 2771 | if datatype.lower() == 'usrp': |
|
2764 | 2772 | try: |
|
2765 | 2773 | ippKm = operationObj.getParameterValue(parameterName='ippKm') |
|
2766 | 2774 | except: |
|
2767 | 2775 | pass |
|
2768 | 2776 | |
|
2769 | 2777 | projectParms = ProjectParms() |
|
2770 | 2778 | |
|
2771 | 2779 | projectParms.name = project_name |
|
2772 | 2780 | projectParms.description = description |
|
2773 | 2781 | projectParms.datatype = datatype |
|
2774 | 2782 | projectParms.ext = None |
|
2775 | 2783 | projectParms.dpath = dpath |
|
2776 | 2784 | projectParms.online = online |
|
2777 | 2785 | projectParms.startDate = startDate |
|
2778 | 2786 | projectParms.endDate = endDate |
|
2779 | 2787 | projectParms.startTime = startTime |
|
2780 | 2788 | projectParms.endTime = endTime |
|
2781 | 2789 | projectParms.delay=delay |
|
2782 | 2790 | projectParms.walk=walk |
|
2783 | 2791 | projectParms.set=set |
|
2784 | 2792 | projectParms.ippKm=ippKm |
|
2785 | 2793 | projectParms.expLabel = expLabel |
|
2786 | 2794 | projectParms.parmsOk=parms_ok |
|
2787 | 2795 | |
|
2788 | 2796 | return projectParms |
|
2789 | 2797 | |
|
2790 | 2798 | def refreshProjectWindow(self, projectObjView): |
|
2791 | 2799 | |
|
2792 | 2800 | self.proOk.setEnabled(False) |
|
2793 | 2801 | |
|
2794 | 2802 | projectParms = self.__getParmsFromProjectObj(projectObjView) |
|
2795 | 2803 | |
|
2796 | 2804 | index = projectParms.getDatatypeIndex() |
|
2797 | 2805 | |
|
2798 | 2806 | self.proName.setText(projectParms.name) |
|
2799 | 2807 | self.proDescription.clear() |
|
2800 | 2808 | self.proDescription.append(projectParms.description) |
|
2801 | 2809 | |
|
2802 | 2810 | self.on_proComDataType_activated(index=index) |
|
2803 | 2811 | self.proDataPath.setText(projectParms.dpath) |
|
2804 | 2812 | self.proComDataType.setCurrentIndex(index) |
|
2805 | 2813 | self.proComReadMode.setCurrentIndex(projectParms.online) |
|
2806 | 2814 | self.proDelay.setText(str(projectParms.delay)) |
|
2807 | 2815 | self.proSet.setText(str(projectParms.set)) |
|
2808 | 2816 | self.proIPPKm.setText(str(projectParms.ippKm)) |
|
2809 | 2817 | self.proComWalk.setCurrentIndex(projectParms.walk) |
|
2810 | 2818 | self.proExpLabel.setText(str(projectParms.expLabel).strip()) |
|
2811 | 2819 | |
|
2812 | 2820 | self.on_proComReadMode_activated(projectParms.online) |
|
2813 | 2821 | self.on_proComWalk_activated(projectParms.walk) |
|
2814 | 2822 | |
|
2815 | 2823 | dateList = self.loadDays(data_path = projectParms.dpath, |
|
2816 | 2824 | ext = projectParms.getExt(), |
|
2817 | 2825 | walk = projectParms.walk, |
|
2818 | 2826 | expLabel = projectParms.expLabel) |
|
2819 | 2827 | |
|
2820 | 2828 | if not dateList: |
|
2821 | 2829 | return 0 |
|
2822 | 2830 | |
|
2823 | 2831 | try: |
|
2824 | 2832 | startDateIndex = dateList.index(projectParms.startDate) |
|
2825 | 2833 | except: |
|
2826 | 2834 | startDateIndex = 0 |
|
2827 | 2835 | |
|
2828 | 2836 | try: |
|
2829 | 2837 | endDateIndex = dateList.index(projectParms.endDate) |
|
2830 | 2838 | except: |
|
2831 | 2839 | endDateIndex = int(self.proComEndDate.count()-1) |
|
2832 | 2840 | |
|
2833 | 2841 | self.proComStartDate.setCurrentIndex(startDateIndex) |
|
2834 | 2842 | self.proComEndDate.setCurrentIndex(endDateIndex) |
|
2835 | 2843 | |
|
2836 | 2844 | startlist = projectParms.startTime.split(":") |
|
2837 | 2845 | endlist = projectParms.endTime.split(":") |
|
2838 | 2846 | |
|
2839 | 2847 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) |
|
2840 | 2848 | self.proStartTime.setTime(self.time) |
|
2841 | 2849 | |
|
2842 | 2850 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
2843 | 2851 | self.proEndTime.setTime(self.time) |
|
2844 | 2852 | |
|
2845 | 2853 | self.proOk.setEnabled(True) |
|
2846 | 2854 | |
|
2847 | 2855 | return 1 |
|
2848 | 2856 | |
|
2849 | 2857 | def __refreshVoltageWindow(self, puObj): |
|
2850 | 2858 | |
|
2851 | 2859 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
2852 | 2860 | if opObj == None: |
|
2853 | 2861 | self.volOpRadarfrequency.clear() |
|
2854 | 2862 | self.volOpCebRadarfrequency.setCheckState(0) |
|
2855 | 2863 | else: |
|
2856 | 2864 | value = opObj.getParameterValue(parameterName='frequency') |
|
2857 | 2865 | value = str(float(value)/1e6) |
|
2858 | 2866 | self.volOpRadarfrequency.setText(value) |
|
2859 | 2867 | self.volOpRadarfrequency.setEnabled(True) |
|
2860 | 2868 | self.volOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
2861 | 2869 | |
|
2862 | 2870 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2863 | 2871 | |
|
2864 | 2872 | if opObj == None: |
|
2865 | 2873 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
2866 | 2874 | |
|
2867 | 2875 | if opObj == None: |
|
2868 | 2876 | self.volOpChannel.clear() |
|
2869 | 2877 | self.volOpCebChannels.setCheckState(0) |
|
2870 | 2878 | else: |
|
2871 | 2879 | channelEnabled = False |
|
2872 | 2880 | try: |
|
2873 | 2881 | value = opObj.getParameterValue(parameterName='channelList') |
|
2874 | 2882 | value = str(value)[1:-1] |
|
2875 | 2883 | channelEnabled = True |
|
2876 | 2884 | channelMode = 0 |
|
2877 | 2885 | except: |
|
2878 | 2886 | pass |
|
2879 | 2887 | try: |
|
2880 | 2888 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
2881 | 2889 | value = str(value)[1:-1] |
|
2882 | 2890 | channelEnabled = True |
|
2883 | 2891 | channelMode = 1 |
|
2884 | 2892 | except: |
|
2885 | 2893 | pass |
|
2886 | 2894 | |
|
2887 | 2895 | if channelEnabled: |
|
2888 | 2896 | self.volOpChannel.setText(value) |
|
2889 | 2897 | self.volOpChannel.setEnabled(True) |
|
2890 | 2898 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) |
|
2891 | 2899 | self.volOpComChannels.setCurrentIndex(channelMode) |
|
2892 | 2900 | |
|
2893 | 2901 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2894 | 2902 | if opObj == None: |
|
2895 | 2903 | self.volOpHeights.clear() |
|
2896 | 2904 | self.volOpCebHeights.setCheckState(0) |
|
2897 | 2905 | else: |
|
2898 | 2906 | value1 = str(opObj.getParameterValue(parameterName='minHei')) |
|
2899 | 2907 | value2 = str(opObj.getParameterValue(parameterName='maxHei')) |
|
2900 | 2908 | value = value1 + "," + value2 |
|
2901 | 2909 | self.volOpHeights.setText(value) |
|
2902 | 2910 | self.volOpHeights.setEnabled(True) |
|
2903 | 2911 | self.volOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
2904 | 2912 | |
|
2905 | 2913 | opObj = puObj.getOperationObj(name="filterByHeights") |
|
2906 | 2914 | if opObj == None: |
|
2907 | 2915 | self.volOpFilter.clear() |
|
2908 | 2916 | self.volOpCebFilter.setCheckState(0) |
|
2909 | 2917 | else: |
|
2910 | 2918 | value = opObj.getParameterValue(parameterName='window') |
|
2911 | 2919 | value = str(value) |
|
2912 | 2920 | self.volOpFilter.setText(value) |
|
2913 | 2921 | self.volOpFilter.setEnabled(True) |
|
2914 | 2922 | self.volOpCebFilter.setCheckState(QtCore.Qt.Checked) |
|
2915 | 2923 | |
|
2916 | 2924 | opObj = puObj.getOperationObj(name="ProfileSelector") |
|
2917 | 2925 | if opObj == None: |
|
2918 | 2926 | self.volOpProfile.clear() |
|
2919 | 2927 | self.volOpCebProfile.setCheckState(0) |
|
2920 | 2928 | else: |
|
2921 | 2929 | for parmObj in opObj.getParameterObjList(): |
|
2922 | 2930 | |
|
2923 | 2931 | if parmObj.name == "profileList": |
|
2924 | 2932 | value = parmObj.getValue() |
|
2925 | 2933 | value = str(value)[1:-1] |
|
2926 | 2934 | self.volOpProfile.setText(value) |
|
2927 | 2935 | self.volOpProfile.setEnabled(True) |
|
2928 | 2936 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2929 | 2937 | self.volOpComProfile.setCurrentIndex(0) |
|
2930 | 2938 | |
|
2931 | 2939 | if parmObj.name == "profileRangeList": |
|
2932 | 2940 | value = parmObj.getValue() |
|
2933 | 2941 | value = str(value)[1:-1] |
|
2934 | 2942 | self.volOpProfile.setText(value) |
|
2935 | 2943 | self.volOpProfile.setEnabled(True) |
|
2936 | 2944 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2937 | 2945 | self.volOpComProfile.setCurrentIndex(1) |
|
2938 | 2946 | |
|
2939 | 2947 | if parmObj.name == "rangeList": |
|
2940 | 2948 | value = parmObj.getValue() |
|
2941 | 2949 | value = str(value)[1:-1] |
|
2942 | 2950 | self.volOpProfile.setText(value) |
|
2943 | 2951 | self.volOpProfile.setEnabled(True) |
|
2944 | 2952 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2945 | 2953 | self.volOpComProfile.setCurrentIndex(2) |
|
2946 | 2954 | |
|
2947 | 2955 | opObj = puObj.getOperationObj(name="Decoder") |
|
2948 | 2956 | self.volOpCode.setText("") |
|
2949 | 2957 | if opObj == None: |
|
2950 | 2958 | self.volOpCebDecodification.setCheckState(0) |
|
2951 | 2959 | else: |
|
2952 | 2960 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) |
|
2953 | 2961 | |
|
2954 | 2962 | parmObj = opObj.getParameterObj('code') |
|
2955 | 2963 | |
|
2956 | 2964 | if parmObj == None: |
|
2957 | 2965 | self.volOpComCode.setCurrentIndex(0) |
|
2958 | 2966 | else: |
|
2959 | 2967 | |
|
2960 | 2968 | parmObj1 = opObj.getParameterObj('nCode') |
|
2961 | 2969 | parmObj2 = opObj.getParameterObj('nBaud') |
|
2962 | 2970 | |
|
2963 | 2971 | if parmObj1 == None or parmObj2 == None: |
|
2964 | 2972 | self.volOpComCode.setCurrentIndex(0) |
|
2965 | 2973 | else: |
|
2966 | 2974 | code = ast.literal_eval(str(parmObj.getValue())) |
|
2967 | 2975 | nCode = parmObj1.getValue() |
|
2968 | 2976 | nBaud = parmObj2.getValue() |
|
2969 | 2977 | |
|
2970 | 2978 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
2971 | 2979 | |
|
2972 | 2980 | #User defined by default |
|
2973 | 2981 | self.volOpComCode.setCurrentIndex(13) |
|
2974 | 2982 | self.volOpCode.setText(str(code)) |
|
2975 | 2983 | |
|
2976 | 2984 | if nCode == 1: |
|
2977 | 2985 | if nBaud == 3: |
|
2978 | 2986 | self.volOpComCode.setCurrentIndex(1) |
|
2979 | 2987 | if nBaud == 4: |
|
2980 | 2988 | self.volOpComCode.setCurrentIndex(2) |
|
2981 | 2989 | if nBaud == 5: |
|
2982 | 2990 | self.volOpComCode.setCurrentIndex(3) |
|
2983 | 2991 | if nBaud == 7: |
|
2984 | 2992 | self.volOpComCode.setCurrentIndex(4) |
|
2985 | 2993 | if nBaud == 11: |
|
2986 | 2994 | self.volOpComCode.setCurrentIndex(5) |
|
2987 | 2995 | if nBaud == 13: |
|
2988 | 2996 | self.volOpComCode.setCurrentIndex(6) |
|
2989 | 2997 | |
|
2990 | 2998 | if nCode == 2: |
|
2991 | 2999 | if nBaud == 3: |
|
2992 | 3000 | self.volOpComCode.setCurrentIndex(7) |
|
2993 | 3001 | if nBaud == 4: |
|
2994 | 3002 | self.volOpComCode.setCurrentIndex(8) |
|
2995 | 3003 | if nBaud == 5: |
|
2996 | 3004 | self.volOpComCode.setCurrentIndex(9) |
|
2997 | 3005 | if nBaud == 7: |
|
2998 | 3006 | self.volOpComCode.setCurrentIndex(10) |
|
2999 | 3007 | if nBaud == 11: |
|
3000 | 3008 | self.volOpComCode.setCurrentIndex(11) |
|
3001 | 3009 | if nBaud == 13: |
|
3002 | 3010 | self.volOpComCode.setCurrentIndex(12) |
|
3003 | 3011 | |
|
3004 | 3012 | |
|
3005 | 3013 | opObj = puObj.getOperationObj(name="deFlip") |
|
3006 | 3014 | if opObj == None: |
|
3007 | 3015 | self.volOpFlip.clear() |
|
3008 | 3016 | self.volOpFlip.setEnabled(False) |
|
3009 | 3017 | self.volOpCebFlip.setCheckState(0) |
|
3010 | 3018 | else: |
|
3011 | 3019 | try: |
|
3012 | 3020 | value = opObj.getParameterValue(parameterName='channelList') |
|
3013 | 3021 | value = str(value)[1:-1] |
|
3014 | 3022 | except: |
|
3015 | 3023 | value = "" |
|
3016 | 3024 | |
|
3017 | 3025 | self.volOpFlip.setText(value) |
|
3018 | 3026 | self.volOpFlip.setEnabled(True) |
|
3019 | 3027 | self.volOpCebFlip.setCheckState(QtCore.Qt.Checked) |
|
3020 | 3028 | |
|
3021 | 3029 | opObj = puObj.getOperationObj(name="CohInt") |
|
3022 | 3030 | if opObj == None: |
|
3023 | 3031 | self.volOpCohInt.clear() |
|
3024 | 3032 | self.volOpCebCohInt.setCheckState(0) |
|
3025 | 3033 | else: |
|
3026 | 3034 | value = opObj.getParameterValue(parameterName='n') |
|
3027 | 3035 | self.volOpCohInt.setText(str(value)) |
|
3028 | 3036 | self.volOpCohInt.setEnabled(True) |
|
3029 | 3037 | self.volOpCebCohInt.setCheckState(QtCore.Qt.Checked) |
|
3030 | 3038 | |
|
3031 | 3039 | opObj = puObj.getOperationObj(name='Scope') |
|
3032 | 3040 | if opObj == None: |
|
3033 | 3041 | self.volGraphCebshow.setCheckState(0) |
|
3034 | 3042 | else: |
|
3035 | 3043 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) |
|
3036 | 3044 | |
|
3037 | 3045 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3038 | 3046 | |
|
3039 | 3047 | if parmObj == None: |
|
3040 | 3048 | self.volGraphChannelList.clear() |
|
3041 | 3049 | else: |
|
3042 | 3050 | value = parmObj.getValue() |
|
3043 | 3051 | value = str(value) |
|
3044 | 3052 | self.volGraphChannelList.setText(value) |
|
3045 | 3053 | # self.volOpChannel.setEnabled(True) |
|
3046 | 3054 | |
|
3047 | 3055 | parmObj1 = opObj.getParameterObj(parameterName='ymin') |
|
3048 | 3056 | parmObj2 = opObj.getParameterObj(parameterName='ymax') |
|
3049 | 3057 | |
|
3050 | 3058 | if parmObj1 == None or parmObj2 ==None: |
|
3051 | 3059 | self.volGraphIntensityRange.clear() |
|
3052 | 3060 | else: |
|
3053 | 3061 | value1 = parmObj1.getValue() |
|
3054 | 3062 | value1 = str(value1) |
|
3055 | 3063 | value2 = parmObj2.getValue() |
|
3056 | 3064 | value2 = str(value2) |
|
3057 | 3065 | value = value1 + "," + value2 |
|
3058 | 3066 | self.volGraphIntensityRange.setText(value) |
|
3059 | 3067 | |
|
3060 | 3068 | parmObj1 = opObj.getParameterObj(parameterName='xmin') |
|
3061 | 3069 | parmObj2 = opObj.getParameterObj(parameterName='xmax') |
|
3062 | 3070 | |
|
3063 | 3071 | if parmObj1 == None or parmObj2 ==None: |
|
3064 | 3072 | self.volGraphHeightrange.clear() |
|
3065 | 3073 | else: |
|
3066 | 3074 | value1 = parmObj1.getValue() |
|
3067 | 3075 | value1 = str(value1) |
|
3068 | 3076 | value2 = parmObj2.getValue() |
|
3069 | 3077 | value2 = str(value2) |
|
3070 | 3078 | value = value1 + "," + value2 |
|
3071 | 3079 | value2 = str(value2) |
|
3072 | 3080 | self.volGraphHeightrange.setText(value) |
|
3073 | 3081 | |
|
3074 | 3082 | parmObj = opObj.getParameterObj(parameterName='type') |
|
3075 | 3083 | |
|
3076 | 3084 | if parmObj == None: |
|
3077 | 3085 | self.volComScopeType.setCurrentIndex(0) |
|
3078 | 3086 | else: |
|
3079 | 3087 | value = parmObj.getValue() |
|
3080 | 3088 | if value == "iq": |
|
3081 | 3089 | self.volComScopeType.setCurrentIndex(0) |
|
3082 | 3090 | if value == "power": |
|
3083 | 3091 | self.volComScopeType.setCurrentIndex(1) |
|
3084 | 3092 | |
|
3085 | 3093 | parmObj = opObj.getParameterObj(parameterName='save') |
|
3086 | 3094 | |
|
3087 | 3095 | if parmObj == None: |
|
3088 | 3096 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
3089 | 3097 | else: |
|
3090 | 3098 | value = parmObj.getValue() |
|
3091 | 3099 | if value: |
|
3092 | 3100 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) |
|
3093 | 3101 | else: |
|
3094 | 3102 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
3095 | 3103 | |
|
3096 | 3104 | parmObj = opObj.getParameterObj(parameterName='figpath') |
|
3097 | 3105 | if parmObj == None: |
|
3098 | 3106 | self.volGraphPath.clear() |
|
3099 | 3107 | else: |
|
3100 | 3108 | value = parmObj.getValue() |
|
3101 | 3109 | path = str(value) |
|
3102 | 3110 | self.volGraphPath.setText(path) |
|
3103 | 3111 | |
|
3104 | 3112 | parmObj = opObj.getParameterObj(parameterName='figfile') |
|
3105 | 3113 | if parmObj == None: |
|
3106 | 3114 | self.volGraphPrefix.clear() |
|
3107 | 3115 | else: |
|
3108 | 3116 | value = parmObj.getValue() |
|
3109 | 3117 | figfile = str(value) |
|
3110 | 3118 | self.volGraphPrefix.setText(figfile) |
|
3111 | 3119 | |
|
3112 | 3120 | # outputVoltageWrite |
|
3113 | 3121 | opObj = puObj.getOperationObj(name='VoltageWriter') |
|
3114 | 3122 | |
|
3115 | 3123 | if opObj == None: |
|
3116 | 3124 | self.volOutputPath.clear() |
|
3117 | 3125 | self.volOutputblocksperfile.clear() |
|
3118 | 3126 | self.volOutputprofilesperblock.clear() |
|
3119 | 3127 | else: |
|
3120 | 3128 | parmObj = opObj.getParameterObj(parameterName='path') |
|
3121 | 3129 | if parmObj == None: |
|
3122 | 3130 | self.volOutputPath.clear() |
|
3123 | 3131 | else: |
|
3124 | 3132 | value = parmObj.getValue() |
|
3125 | 3133 | path = str(value) |
|
3126 | 3134 | self.volOutputPath.setText(path) |
|
3127 | 3135 | |
|
3128 | 3136 | parmObj = opObj.getParameterObj(parameterName='blocksPerFile') |
|
3129 | 3137 | if parmObj == None: |
|
3130 | 3138 | self.volOutputblocksperfile.clear() |
|
3131 | 3139 | else: |
|
3132 | 3140 | value = parmObj.getValue() |
|
3133 | 3141 | blocksperfile = str(value) |
|
3134 | 3142 | self.volOutputblocksperfile.setText(blocksperfile) |
|
3135 | 3143 | |
|
3136 | 3144 | parmObj = opObj.getParameterObj(parameterName='profilesPerBlock') |
|
3137 | 3145 | if parmObj == None: |
|
3138 | 3146 | self.volOutputprofilesperblock.clear() |
|
3139 | 3147 | else: |
|
3140 | 3148 | value = parmObj.getValue() |
|
3141 | 3149 | profilesPerBlock = str(value) |
|
3142 | 3150 | self.volOutputprofilesperblock.setText(profilesPerBlock) |
|
3143 | 3151 | |
|
3144 | 3152 | return |
|
3145 | 3153 | |
|
3146 | 3154 | def __refreshSpectraWindow(self, puObj): |
|
3147 | 3155 | |
|
3148 | 3156 | inputId = puObj.getInputId() |
|
3149 | 3157 | inputPUObj = self.__puObjDict[inputId] |
|
3150 | 3158 | |
|
3151 | 3159 | if inputPUObj.datatype == 'Voltage': |
|
3152 | 3160 | self.specOpnFFTpoints.setEnabled(True) |
|
3153 | 3161 | self.specOpProfiles.setEnabled(True) |
|
3154 | 3162 | self.specOpippFactor.setEnabled(True) |
|
3155 | 3163 | else: |
|
3156 | 3164 | self.specOpnFFTpoints.setEnabled(False) |
|
3157 | 3165 | self.specOpProfiles.setEnabled(False) |
|
3158 | 3166 | self.specOpippFactor.setEnabled(False) |
|
3159 | 3167 | |
|
3160 | 3168 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
3161 | 3169 | if opObj == None: |
|
3162 | 3170 | self.specOpRadarfrequency.clear() |
|
3163 | 3171 | self.specOpCebRadarfrequency.setCheckState(0) |
|
3164 | 3172 | else: |
|
3165 | 3173 | value = opObj.getParameterValue(parameterName='frequency') |
|
3166 | 3174 | value = str(float(value)/1e6) |
|
3167 | 3175 | self.specOpRadarfrequency.setText(value) |
|
3168 | 3176 | self.specOpRadarfrequency.setEnabled(True) |
|
3169 | 3177 | self.specOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
3170 | 3178 | |
|
3171 | 3179 | opObj = puObj.getOperationObj(name="run") |
|
3172 | 3180 | if opObj == None: |
|
3173 | 3181 | self.specOpnFFTpoints.clear() |
|
3174 | 3182 | self.specOpProfiles.clear() |
|
3175 | 3183 | self.specOpippFactor.clear() |
|
3176 | 3184 | else: |
|
3177 | 3185 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') |
|
3178 | 3186 | if parmObj == None: |
|
3179 | 3187 | self.specOpnFFTpoints.clear() |
|
3180 | 3188 | else: |
|
3181 | 3189 | self.specOpnFFTpoints.setEnabled(True) |
|
3182 | 3190 | value = opObj.getParameterValue(parameterName='nFFTPoints') |
|
3183 | 3191 | self.specOpnFFTpoints.setText(str(value)) |
|
3184 | 3192 | |
|
3185 | 3193 | parmObj = opObj.getParameterObj(parameterName='nProfiles') |
|
3186 | 3194 | if parmObj == None: |
|
3187 | 3195 | self.specOpProfiles.clear() |
|
3188 | 3196 | else: |
|
3189 | 3197 | self.specOpProfiles.setEnabled(True) |
|
3190 | 3198 | value = opObj.getParameterValue(parameterName='nProfiles') |
|
3191 | 3199 | self.specOpProfiles.setText(str(value)) |
|
3192 | 3200 | |
|
3193 | 3201 | parmObj = opObj.getParameterObj(parameterName='ippFactor') |
|
3194 | 3202 | if parmObj == None: |
|
3195 | 3203 | self.specOpippFactor.clear() |
|
3196 | 3204 | else: |
|
3197 | 3205 | self.specOpippFactor.setEnabled(True) |
|
3198 | 3206 | value = opObj.getParameterValue(parameterName='ippFactor') |
|
3199 | 3207 | self.specOpippFactor.setText(str(value)) |
|
3200 | 3208 | |
|
3201 | 3209 | opObj = puObj.getOperationObj(name="run") |
|
3202 | 3210 | if opObj == None: |
|
3203 | 3211 | self.specOppairsList.clear() |
|
3204 | 3212 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3205 | 3213 | else: |
|
3206 | 3214 | parmObj = opObj.getParameterObj(parameterName='pairsList') |
|
3207 | 3215 | if parmObj == None: |
|
3208 | 3216 | self.specOppairsList.clear() |
|
3209 | 3217 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3210 | 3218 | else: |
|
3211 | 3219 | value = opObj.getParameterValue(parameterName='pairsList') |
|
3212 | 3220 | value = str(value)[1:-1] |
|
3213 | 3221 | self.specOppairsList.setText(str(value)) |
|
3214 | 3222 | self.specOppairsList.setEnabled(True) |
|
3215 | 3223 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) |
|
3216 | 3224 | |
|
3217 | 3225 | opObj = puObj.getOperationObj(name="selectChannels") |
|
3218 | 3226 | |
|
3219 | 3227 | if opObj == None: |
|
3220 | 3228 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
3221 | 3229 | |
|
3222 | 3230 | if opObj == None: |
|
3223 | 3231 | self.specOpChannel.clear() |
|
3224 | 3232 | self.specOpCebChannel.setCheckState(0) |
|
3225 | 3233 | else: |
|
3226 | 3234 | channelEnabled = False |
|
3227 | 3235 | try: |
|
3228 | 3236 | value = opObj.getParameterValue(parameterName='channelList') |
|
3229 | 3237 | value = str(value)[1:-1] |
|
3230 | 3238 | channelEnabled = True |
|
3231 | 3239 | channelMode = 0 |
|
3232 | 3240 | except: |
|
3233 | 3241 | pass |
|
3234 | 3242 | try: |
|
3235 | 3243 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
3236 | 3244 | value = str(value)[1:-1] |
|
3237 | 3245 | channelEnabled = True |
|
3238 | 3246 | channelMode = 1 |
|
3239 | 3247 | except: |
|
3240 | 3248 | pass |
|
3241 | 3249 | |
|
3242 | 3250 | if channelEnabled: |
|
3243 | 3251 | self.specOpChannel.setText(value) |
|
3244 | 3252 | self.specOpChannel.setEnabled(True) |
|
3245 | 3253 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) |
|
3246 | 3254 | self.specOpComChannel.setCurrentIndex(channelMode) |
|
3247 | 3255 | |
|
3248 | 3256 | opObj = puObj.getOperationObj(name="selectHeights") |
|
3249 | 3257 | if opObj == None: |
|
3250 | 3258 | self.specOpHeights.clear() |
|
3251 | 3259 | self.specOpCebHeights.setCheckState(0) |
|
3252 | 3260 | else: |
|
3253 | 3261 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
3254 | 3262 | value1 = str(value1) |
|
3255 | 3263 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
3256 | 3264 | value2 = str(value2) |
|
3257 | 3265 | value = value1 + "," + value2 |
|
3258 | 3266 | self.specOpHeights.setText(value) |
|
3259 | 3267 | self.specOpHeights.setEnabled(True) |
|
3260 | 3268 | self.specOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
3261 | 3269 | |
|
3262 | 3270 | opObj = puObj.getOperationObj(name="IncohInt") |
|
3263 | 3271 | if opObj == None: |
|
3264 | 3272 | self.specOpIncoherent.clear() |
|
3265 | 3273 | self.specOpCebIncoherent.setCheckState(0) |
|
3266 | 3274 | else: |
|
3267 | 3275 | for parmObj in opObj.getParameterObjList(): |
|
3268 | 3276 | if parmObj.name == 'timeInterval': |
|
3269 | 3277 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3270 | 3278 | self.specOpIncoherent.setText(str(value)) |
|
3271 | 3279 | self.specOpIncoherent.setEnabled(True) |
|
3272 | 3280 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3273 | 3281 | self.specOpCobIncInt.setCurrentIndex(0) |
|
3274 | 3282 | |
|
3275 | 3283 | if parmObj.name == 'n': |
|
3276 | 3284 | value = opObj.getParameterValue(parameterName='n') |
|
3277 | 3285 | self.specOpIncoherent.setText(str(value)) |
|
3278 | 3286 | self.specOpIncoherent.setEnabled(True) |
|
3279 | 3287 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3280 | 3288 | self.specOpCobIncInt.setCurrentIndex(1) |
|
3281 | 3289 | |
|
3282 | 3290 | opObj = puObj.getOperationObj(name="removeDC") |
|
3283 | 3291 | if opObj == None: |
|
3284 | 3292 | self.specOpCebRemoveDC.setCheckState(0) |
|
3285 | 3293 | else: |
|
3286 | 3294 | self.specOpCebRemoveDC.setCheckState(QtCore.Qt.Checked) |
|
3287 | 3295 | |
|
3288 | 3296 | parmObj = opObj.getParameterObj(parameterName='mode') |
|
3289 | 3297 | |
|
3290 | 3298 | value = 1 |
|
3291 | 3299 | if parmObj: |
|
3292 | 3300 | value = parmObj.getValue() |
|
3293 | 3301 | |
|
3294 | 3302 | if value == 1: |
|
3295 | 3303 | self.specOpComRemoveDC.setCurrentIndex(0) |
|
3296 | 3304 | elif value == 2: |
|
3297 | 3305 | self.specOpComRemoveDC.setCurrentIndex(1) |
|
3298 | 3306 | |
|
3299 | 3307 | opObj = puObj.getOperationObj(name="removeInterference") |
|
3300 | 3308 | if opObj == None: |
|
3301 | 3309 | self.specOpCebRemoveInt.setCheckState(0) |
|
3302 | 3310 | else: |
|
3303 | 3311 | self.specOpCebRemoveInt.setCheckState(QtCore.Qt.Checked) |
|
3304 | 3312 | |
|
3305 | 3313 | opObj = puObj.getOperationObj(name='getNoise') |
|
3306 | 3314 | if opObj == None: |
|
3307 | 3315 | self.specOpCebgetNoise.setCheckState(0) |
|
3308 | 3316 | self.specOpgetNoise.clear() |
|
3309 | 3317 | else: |
|
3310 | 3318 | self.specOpCebgetNoise.setCheckState(QtCore.Qt.Checked) |
|
3311 | 3319 | parmObj = opObj.getParameterObj(parameterName='minHei') |
|
3312 | 3320 | if parmObj == None: |
|
3313 | 3321 | self.specOpgetNoise.clear() |
|
3314 | 3322 | value1 = None |
|
3315 | 3323 | else: |
|
3316 | 3324 | value1 = opObj.getParameterValue(parameterName='minHei') |
|
3317 | 3325 | value1 = str(value1) |
|
3318 | 3326 | parmObj = opObj.getParameterObj(parameterName='maxHei') |
|
3319 | 3327 | if parmObj == None: |
|
3320 | 3328 | value2 = None |
|
3321 | 3329 | value = value1 |
|
3322 | 3330 | self.specOpgetNoise.setText(value) |
|
3323 | 3331 | self.specOpgetNoise.setEnabled(True) |
|
3324 | 3332 | else: |
|
3325 | 3333 | value2 = opObj.getParameterValue(parameterName='maxHei') |
|
3326 | 3334 | value2 = str(value2) |
|
3327 | 3335 | parmObj = opObj.getParameterObj(parameterName='minVel') |
|
3328 | 3336 | if parmObj == None: |
|
3329 | 3337 | value3 = None |
|
3330 | 3338 | value = value1 + "," + value2 |
|
3331 | 3339 | self.specOpgetNoise.setText(value) |
|
3332 | 3340 | self.specOpgetNoise.setEnabled(True) |
|
3333 | 3341 | else: |
|
3334 | 3342 | value3 = opObj.getParameterValue(parameterName='minVel') |
|
3335 | 3343 | value3 = str(value3) |
|
3336 | 3344 | parmObj = opObj.getParameterObj(parameterName='maxVel') |
|
3337 | 3345 | if parmObj == None: |
|
3338 | 3346 | value4 = None |
|
3339 | 3347 | value = value1 + "," + value2 + "," + value3 |
|
3340 | 3348 | self.specOpgetNoise.setText(value) |
|
3341 | 3349 | self.specOpgetNoise.setEnabled(True) |
|
3342 | 3350 | else: |
|
3343 | 3351 | value4 = opObj.getParameterValue(parameterName='maxVel') |
|
3344 | 3352 | value4 = str(value4) |
|
3345 | 3353 | value = value1 + "," + value2 + "," + value3 + ',' + value4 |
|
3346 | 3354 | self.specOpgetNoise.setText(value) |
|
3347 | 3355 | self.specOpgetNoise.setEnabled(True) |
|
3348 | 3356 | |
|
3349 | 3357 | self.specGraphPath.clear() |
|
3350 | 3358 | self.specGraphPrefix.clear() |
|
3351 | 3359 | self.specGgraphFreq.clear() |
|
3352 | 3360 | self.specGgraphHeight.clear() |
|
3353 | 3361 | self.specGgraphDbsrange.clear() |
|
3354 | 3362 | self.specGgraphmagnitud.clear() |
|
3355 | 3363 | self.specGgraphPhase.clear() |
|
3356 | 3364 | self.specGgraphChannelList.clear() |
|
3357 | 3365 | self.specGgraphTminTmax.clear() |
|
3358 | 3366 | self.specGgraphTimeRange.clear() |
|
3359 | 3367 | self.specGgraphftpratio.clear() |
|
3360 | 3368 | |
|
3361 | 3369 | opObj = puObj.getOperationObj(name='SpectraPlot') |
|
3362 | 3370 | |
|
3363 | 3371 | if opObj == None: |
|
3364 | 3372 | self.specGraphCebSpectraplot.setCheckState(0) |
|
3365 | 3373 | self.specGraphSaveSpectra.setCheckState(0) |
|
3366 | 3374 | self.specGraphftpSpectra.setCheckState(0) |
|
3367 | 3375 | else: |
|
3368 | 3376 | operationSpectraPlot = "Enable" |
|
3369 | 3377 | self.specGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3370 | 3378 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3371 | 3379 | if parmObj == None: |
|
3372 | 3380 | self.specGgraphChannelList.clear() |
|
3373 | 3381 | else: |
|
3374 | 3382 | value = opObj.getParameterValue(parameterName='channelList') |
|
3375 | 3383 | channelListSpectraPlot = str(value)[1:-1] |
|
3376 | 3384 | self.specGgraphChannelList.setText(channelListSpectraPlot) |
|
3377 | 3385 | self.specGgraphChannelList.setEnabled(True) |
|
3378 | 3386 | |
|
3379 | 3387 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3380 | 3388 | if parmObj == None: |
|
3381 | 3389 | self.specGgraphFreq.clear() |
|
3382 | 3390 | else: |
|
3383 | 3391 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3384 | 3392 | value1 = str(value1) |
|
3385 | 3393 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3386 | 3394 | value2 = str(value2) |
|
3387 | 3395 | value = value1 + "," + value2 |
|
3388 | 3396 | self.specGgraphFreq.setText(value) |
|
3389 | 3397 | self.specGgraphFreq.setEnabled(True) |
|
3390 | 3398 | |
|
3391 | 3399 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3392 | 3400 | if parmObj == None: |
|
3393 | 3401 | self.specGgraphHeight.clear() |
|
3394 | 3402 | else: |
|
3395 | 3403 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3396 | 3404 | value1 = str(value1) |
|
3397 | 3405 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3398 | 3406 | value2 = str(value2) |
|
3399 | 3407 | value = value1 + "," + value2 |
|
3400 | 3408 | self.specGgraphHeight.setText(value) |
|
3401 | 3409 | self.specGgraphHeight.setEnabled(True) |
|
3402 | 3410 | |
|
3403 | 3411 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3404 | 3412 | if parmObj == None: |
|
3405 | 3413 | self.specGgraphDbsrange.clear() |
|
3406 | 3414 | else: |
|
3407 | 3415 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3408 | 3416 | value1 = str(value1) |
|
3409 | 3417 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3410 | 3418 | value2 = str(value2) |
|
3411 | 3419 | value = value1 + "," + value2 |
|
3412 | 3420 | self.specGgraphDbsrange.setText(value) |
|
3413 | 3421 | self.specGgraphDbsrange.setEnabled(True) |
|
3414 | 3422 | |
|
3415 | 3423 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3416 | 3424 | if parmObj == None: |
|
3417 | 3425 | self.specGraphSaveSpectra.setCheckState(0) |
|
3418 | 3426 | else: |
|
3419 | 3427 | self.specGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3420 | 3428 | |
|
3421 | 3429 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3422 | 3430 | if parmObj == None: |
|
3423 | 3431 | self.specGraphftpSpectra.setCheckState(0) |
|
3424 | 3432 | else: |
|
3425 | 3433 | self.specGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3426 | 3434 | |
|
3427 | 3435 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3428 | 3436 | if parmObj: |
|
3429 | 3437 | value = parmObj.getValue() |
|
3430 | 3438 | self.specGraphPath.setText(value) |
|
3431 | 3439 | |
|
3432 | 3440 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3433 | 3441 | if parmObj: |
|
3434 | 3442 | value = parmObj.getValue() |
|
3435 | 3443 | self.specGgraphftpratio.setText(str(value)) |
|
3436 | 3444 | |
|
3437 | 3445 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') |
|
3438 | 3446 | |
|
3439 | 3447 | if opObj == None: |
|
3440 | 3448 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
3441 | 3449 | self.specGraphSaveCross.setCheckState(0) |
|
3442 | 3450 | self.specGraphftpCross.setCheckState(0) |
|
3443 | 3451 | else: |
|
3444 | 3452 | operationCrossSpectraPlot = "Enable" |
|
3445 | 3453 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3446 | 3454 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3447 | 3455 | if parmObj == None: |
|
3448 | 3456 | self.specGgraphFreq.clear() |
|
3449 | 3457 | else: |
|
3450 | 3458 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3451 | 3459 | value1 = str(value1) |
|
3452 | 3460 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3453 | 3461 | value2 = str(value2) |
|
3454 | 3462 | value = value1 + "," + value2 |
|
3455 | 3463 | self.specGgraphFreq.setText(value) |
|
3456 | 3464 | self.specGgraphFreq.setEnabled(True) |
|
3457 | 3465 | |
|
3458 | 3466 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3459 | 3467 | if parmObj == None: |
|
3460 | 3468 | self.specGgraphHeight.clear() |
|
3461 | 3469 | else: |
|
3462 | 3470 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3463 | 3471 | value1 = str(value1) |
|
3464 | 3472 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3465 | 3473 | value2 = str(value2) |
|
3466 | 3474 | value = value1 + "," + value2 |
|
3467 | 3475 | self.specGgraphHeight.setText(value) |
|
3468 | 3476 | self.specGgraphHeight.setEnabled(True) |
|
3469 | 3477 | |
|
3470 | 3478 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3471 | 3479 | if parmObj == None: |
|
3472 | 3480 | self.specGgraphDbsrange.clear() |
|
3473 | 3481 | else: |
|
3474 | 3482 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3475 | 3483 | value1 = str(value1) |
|
3476 | 3484 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3477 | 3485 | value2 = str(value2) |
|
3478 | 3486 | value = value1 + "," + value2 |
|
3479 | 3487 | self.specGgraphDbsrange.setText(value) |
|
3480 | 3488 | self.specGgraphDbsrange.setEnabled(True) |
|
3481 | 3489 | |
|
3482 | 3490 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3483 | 3491 | if parmObj == None: |
|
3484 | 3492 | self.specGgraphmagnitud.clear() |
|
3485 | 3493 | else: |
|
3486 | 3494 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3487 | 3495 | value1 = str(value1) |
|
3488 | 3496 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3489 | 3497 | value2 = str(value2) |
|
3490 | 3498 | value = value1 + "," + value2 |
|
3491 | 3499 | self.specGgraphmagnitud.setText(value) |
|
3492 | 3500 | self.specGgraphmagnitud.setEnabled(True) |
|
3493 | 3501 | |
|
3494 | 3502 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3495 | 3503 | if parmObj == None: |
|
3496 | 3504 | self.specGgraphPhase.clear() |
|
3497 | 3505 | else: |
|
3498 | 3506 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3499 | 3507 | value1 = str(value1) |
|
3500 | 3508 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3501 | 3509 | value2 = str(value2) |
|
3502 | 3510 | value = value1 + "," + value2 |
|
3503 | 3511 | self.specGgraphPhase.setText(value) |
|
3504 | 3512 | self.specGgraphPhase.setEnabled(True) |
|
3505 | 3513 | |
|
3506 | 3514 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3507 | 3515 | if parmObj == None: |
|
3508 | 3516 | self.specGraphSaveCross.setCheckState(0) |
|
3509 | 3517 | else: |
|
3510 | 3518 | self.specGraphSaveCross.setCheckState(QtCore.Qt.Checked) |
|
3511 | 3519 | |
|
3512 | 3520 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3513 | 3521 | if parmObj == None: |
|
3514 | 3522 | self.specGraphftpCross.setCheckState(0) |
|
3515 | 3523 | else: |
|
3516 | 3524 | self.specGraphftpCross.setCheckState(QtCore.Qt.Checked) |
|
3517 | 3525 | |
|
3518 | 3526 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3519 | 3527 | if parmObj: |
|
3520 | 3528 | value = parmObj.getValue() |
|
3521 | 3529 | self.specGraphPath.setText(value) |
|
3522 | 3530 | |
|
3523 | 3531 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3524 | 3532 | if parmObj: |
|
3525 | 3533 | value = parmObj.getValue() |
|
3526 | 3534 | self.specGgraphftpratio.setText(str(value)) |
|
3527 | 3535 | |
|
3528 | 3536 | opObj = puObj.getOperationObj(name='RTIPlot') |
|
3529 | 3537 | |
|
3530 | 3538 | if opObj == None: |
|
3531 | 3539 | self.specGraphCebRTIplot.setCheckState(0) |
|
3532 | 3540 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3533 | 3541 | self.specGraphftpRTIplot.setCheckState(0) |
|
3534 | 3542 | else: |
|
3535 | 3543 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3536 | 3544 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3537 | 3545 | if parmObj == None: |
|
3538 | 3546 | self.specGgraphChannelList.clear() |
|
3539 | 3547 | else: |
|
3540 | 3548 | value = opObj.getParameterValue(parameterName='channelList') |
|
3541 | 3549 | channelListRTIPlot = str(value)[1:-1] |
|
3542 | 3550 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3543 | 3551 | self.specGgraphChannelList.setEnabled(True) |
|
3544 | 3552 | |
|
3545 | 3553 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3546 | 3554 | if parmObj == None: |
|
3547 | 3555 | self.specGgraphTminTmax.clear() |
|
3548 | 3556 | else: |
|
3549 | 3557 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3550 | 3558 | value1 = str(value1) |
|
3551 | 3559 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3552 | 3560 | value2 = str(value2) |
|
3553 | 3561 | value = value1 + "," + value2 |
|
3554 | 3562 | self.specGgraphTminTmax.setText(value) |
|
3555 | 3563 | self.specGgraphTminTmax.setEnabled(True) |
|
3556 | 3564 | |
|
3557 | 3565 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3558 | 3566 | if parmObj == None: |
|
3559 | 3567 | self.specGgraphTimeRange.clear() |
|
3560 | 3568 | else: |
|
3561 | 3569 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3562 | 3570 | value1 = str(value1) |
|
3563 | 3571 | self.specGgraphTimeRange.setText(value1) |
|
3564 | 3572 | self.specGgraphTimeRange.setEnabled(True) |
|
3565 | 3573 | |
|
3566 | 3574 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3567 | 3575 | if parmObj == None: |
|
3568 | 3576 | self.specGgraphHeight.clear() |
|
3569 | 3577 | else: |
|
3570 | 3578 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3571 | 3579 | value1 = str(value1) |
|
3572 | 3580 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3573 | 3581 | value2 = str(value2) |
|
3574 | 3582 | value = value1 + "," + value2 |
|
3575 | 3583 | self.specGgraphHeight.setText(value) |
|
3576 | 3584 | self.specGgraphHeight.setEnabled(True) |
|
3577 | 3585 | |
|
3578 | 3586 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3579 | 3587 | if parmObj == None: |
|
3580 | 3588 | self.specGgraphDbsrange.clear() |
|
3581 | 3589 | else: |
|
3582 | 3590 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3583 | 3591 | value1 = str(value1) |
|
3584 | 3592 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3585 | 3593 | value2 = str(value2) |
|
3586 | 3594 | value = value1 + "," + value2 |
|
3587 | 3595 | self.specGgraphDbsrange.setText(value) |
|
3588 | 3596 | self.specGgraphDbsrange.setEnabled(True) |
|
3589 | 3597 | |
|
3590 | 3598 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3591 | 3599 | if parmObj == None: |
|
3592 | 3600 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3593 | 3601 | else: |
|
3594 | 3602 | self.specGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3595 | 3603 | |
|
3596 | 3604 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3597 | 3605 | if parmObj == None: |
|
3598 | 3606 | self.specGraphftpRTIplot.setCheckState(0) |
|
3599 | 3607 | else: |
|
3600 | 3608 | self.specGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3601 | 3609 | |
|
3602 | 3610 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3603 | 3611 | if parmObj: |
|
3604 | 3612 | value = parmObj.getValue() |
|
3605 | 3613 | self.specGraphPath.setText(value) |
|
3606 | 3614 | |
|
3607 | 3615 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3608 | 3616 | if parmObj: |
|
3609 | 3617 | value = parmObj.getValue() |
|
3610 | 3618 | self.specGgraphftpratio.setText(str(value)) |
|
3611 | 3619 | |
|
3612 | 3620 | opObj = puObj.getOperationObj(name='CoherenceMap') |
|
3613 | 3621 | |
|
3614 | 3622 | if opObj == None: |
|
3615 | 3623 | self.specGraphCebCoherencmap.setCheckState(0) |
|
3616 | 3624 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3617 | 3625 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3618 | 3626 | else: |
|
3619 | 3627 | operationCoherenceMap = "Enable" |
|
3620 | 3628 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) |
|
3621 | 3629 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3622 | 3630 | if parmObj == None: |
|
3623 | 3631 | self.specGgraphTminTmax.clear() |
|
3624 | 3632 | else: |
|
3625 | 3633 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3626 | 3634 | value1 = str(value1) |
|
3627 | 3635 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3628 | 3636 | value2 = str(value2) |
|
3629 | 3637 | value = value1 + "," + value2 |
|
3630 | 3638 | self.specGgraphTminTmax.setText(value) |
|
3631 | 3639 | self.specGgraphTminTmax.setEnabled(True) |
|
3632 | 3640 | |
|
3633 | 3641 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3634 | 3642 | if parmObj == None: |
|
3635 | 3643 | self.specGgraphTimeRange.clear() |
|
3636 | 3644 | else: |
|
3637 | 3645 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3638 | 3646 | value1 = str(value1) |
|
3639 | 3647 | self.specGgraphTimeRange.setText(value1) |
|
3640 | 3648 | self.specGgraphTimeRange.setEnabled(True) |
|
3641 | 3649 | |
|
3642 | 3650 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3643 | 3651 | if parmObj == None: |
|
3644 | 3652 | self.specGgraphHeight.clear() |
|
3645 | 3653 | else: |
|
3646 | 3654 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3647 | 3655 | value1 = str(value1) |
|
3648 | 3656 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3649 | 3657 | value2 = str(value2) |
|
3650 | 3658 | value = value1 + "," + value2 |
|
3651 | 3659 | self.specGgraphHeight.setText(value) |
|
3652 | 3660 | self.specGgraphHeight.setEnabled(True) |
|
3653 | 3661 | |
|
3654 | 3662 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3655 | 3663 | if parmObj == None: |
|
3656 | 3664 | self.specGgraphmagnitud.clear() |
|
3657 | 3665 | else: |
|
3658 | 3666 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3659 | 3667 | value1 = str(value1) |
|
3660 | 3668 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3661 | 3669 | value2 = str(value2) |
|
3662 | 3670 | value = value1 + "," + value2 |
|
3663 | 3671 | self.specGgraphmagnitud.setText(value) |
|
3664 | 3672 | self.specGgraphmagnitud.setEnabled(True) |
|
3665 | 3673 | |
|
3666 | 3674 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3667 | 3675 | if parmObj == None: |
|
3668 | 3676 | self.specGgraphmagnitud.clear() |
|
3669 | 3677 | else: |
|
3670 | 3678 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3671 | 3679 | value1 = str(value1) |
|
3672 | 3680 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3673 | 3681 | value2 = str(value2) |
|
3674 | 3682 | value = value1 + "," + value2 |
|
3675 | 3683 | self.specGgraphmagnitud.setText(value) |
|
3676 | 3684 | self.specGgraphmagnitud.setEnabled(True) |
|
3677 | 3685 | |
|
3678 | 3686 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3679 | 3687 | if parmObj == None: |
|
3680 | 3688 | self.specGgraphPhase.clear() |
|
3681 | 3689 | else: |
|
3682 | 3690 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3683 | 3691 | value1 = str(value1) |
|
3684 | 3692 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3685 | 3693 | value2 = str(value2) |
|
3686 | 3694 | value = value1 + "," + value2 |
|
3687 | 3695 | self.specGgraphPhase.setText(value) |
|
3688 | 3696 | self.specGgraphPhase.setEnabled(True) |
|
3689 | 3697 | |
|
3690 | 3698 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3691 | 3699 | if parmObj == None: |
|
3692 | 3700 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3693 | 3701 | else: |
|
3694 | 3702 | self.specGraphSaveCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3695 | 3703 | |
|
3696 | 3704 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3697 | 3705 | if parmObj == None: |
|
3698 | 3706 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3699 | 3707 | else: |
|
3700 | 3708 | self.specGraphftpCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3701 | 3709 | |
|
3702 | 3710 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3703 | 3711 | if parmObj: |
|
3704 | 3712 | value = parmObj.getValue() |
|
3705 | 3713 | self.specGraphPath.setText(value) |
|
3706 | 3714 | |
|
3707 | 3715 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3708 | 3716 | if parmObj: |
|
3709 | 3717 | value = parmObj.getValue() |
|
3710 | 3718 | self.specGgraphftpratio.setText(str(value)) |
|
3711 | 3719 | |
|
3712 | 3720 | opObj = puObj.getOperationObj(name='PowerProfilePlot') |
|
3713 | 3721 | |
|
3714 | 3722 | if opObj == None: |
|
3715 | 3723 | self.specGraphPowerprofile.setCheckState(0) |
|
3716 | 3724 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3717 | 3725 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3718 | 3726 | operationPowerProfilePlot = "Disabled" |
|
3719 | 3727 | channelList = None |
|
3720 | 3728 | freq_vel = None |
|
3721 | 3729 | heightsrange = None |
|
3722 | 3730 | else: |
|
3723 | 3731 | operationPowerProfilePlot = "Enable" |
|
3724 | 3732 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3725 | 3733 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3726 | 3734 | if parmObj == None: |
|
3727 | 3735 | self.specGgraphDbsrange.clear() |
|
3728 | 3736 | else: |
|
3729 | 3737 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3730 | 3738 | value1 = str(value1) |
|
3731 | 3739 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3732 | 3740 | value2 = str(value2) |
|
3733 | 3741 | value = value1 + "," + value2 |
|
3734 | 3742 | self.specGgraphDbsrange.setText(value) |
|
3735 | 3743 | self.specGgraphDbsrange.setEnabled(True) |
|
3736 | 3744 | |
|
3737 | 3745 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3738 | 3746 | if parmObj == None: |
|
3739 | 3747 | self.specGgraphHeight.clear() |
|
3740 | 3748 | else: |
|
3741 | 3749 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3742 | 3750 | value1 = str(value1) |
|
3743 | 3751 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3744 | 3752 | value2 = str(value2) |
|
3745 | 3753 | value = value1 + "," + value2 |
|
3746 | 3754 | self.specGgraphHeight.setText(value) |
|
3747 | 3755 | self.specGgraphHeight.setEnabled(True) |
|
3748 | 3756 | |
|
3749 | 3757 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3750 | 3758 | if parmObj == None: |
|
3751 | 3759 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3752 | 3760 | else: |
|
3753 | 3761 | self.specGraphSavePowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3754 | 3762 | |
|
3755 | 3763 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3756 | 3764 | if parmObj == None: |
|
3757 | 3765 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3758 | 3766 | else: |
|
3759 | 3767 | self.specGraphftpPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3760 | 3768 | |
|
3761 | 3769 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3762 | 3770 | if parmObj: |
|
3763 | 3771 | value = parmObj.getValue() |
|
3764 | 3772 | self.specGraphPath.setText(value) |
|
3765 | 3773 | |
|
3766 | 3774 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3767 | 3775 | if parmObj: |
|
3768 | 3776 | value = parmObj.getValue() |
|
3769 | 3777 | self.specGgraphftpratio.setText(str(value)) |
|
3770 | 3778 | |
|
3771 | 3779 | opObj = puObj.getOperationObj(name='Noise') |
|
3772 | 3780 | |
|
3773 | 3781 | if opObj == None: |
|
3774 | 3782 | self.specGraphCebRTInoise.setCheckState(0) |
|
3775 | 3783 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3776 | 3784 | self.specGraphftpRTInoise.setCheckState(0) |
|
3777 | 3785 | else: |
|
3778 | 3786 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3779 | 3787 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3780 | 3788 | if parmObj == None: |
|
3781 | 3789 | self.specGgraphChannelList.clear() |
|
3782 | 3790 | else: |
|
3783 | 3791 | value = opObj.getParameterValue(parameterName='channelList') |
|
3784 | 3792 | channelListRTINoise = str(value)[1:-1] |
|
3785 | 3793 | self.specGgraphChannelList.setText(channelListRTINoise) |
|
3786 | 3794 | self.specGgraphChannelList.setEnabled(True) |
|
3787 | 3795 | |
|
3788 | 3796 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3789 | 3797 | if parmObj == None: |
|
3790 | 3798 | self.specGgraphTminTmax.clear() |
|
3791 | 3799 | else: |
|
3792 | 3800 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3793 | 3801 | value1 = str(value1) |
|
3794 | 3802 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3795 | 3803 | value2 = str(value2) |
|
3796 | 3804 | value = value1 + "," + value2 |
|
3797 | 3805 | self.specGgraphTminTmax.setText(value) |
|
3798 | 3806 | self.specGgraphTminTmax.setEnabled(True) |
|
3799 | 3807 | |
|
3800 | 3808 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3801 | 3809 | if parmObj == None: |
|
3802 | 3810 | self.specGgraphTimeRange.clear() |
|
3803 | 3811 | else: |
|
3804 | 3812 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3805 | 3813 | value1 = str(value1) |
|
3806 | 3814 | self.specGgraphTimeRange.setText(value1) |
|
3807 | 3815 | self.specGgraphTimeRange.setEnabled(True) |
|
3808 | 3816 | |
|
3809 | 3817 | |
|
3810 | 3818 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3811 | 3819 | if parmObj == None: |
|
3812 | 3820 | self.specGgraphDbsrange.clear() |
|
3813 | 3821 | else: |
|
3814 | 3822 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3815 | 3823 | value1 = str(value1) |
|
3816 | 3824 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3817 | 3825 | value2 = str(value2) |
|
3818 | 3826 | value = value1 + "," + value2 |
|
3819 | 3827 | self.specGgraphDbsrange.setText(value) |
|
3820 | 3828 | self.specGgraphDbsrange.setEnabled(True) |
|
3821 | 3829 | |
|
3822 | 3830 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3823 | 3831 | if parmObj == None: |
|
3824 | 3832 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3825 | 3833 | else: |
|
3826 | 3834 | self.specGraphSaveRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3827 | 3835 | |
|
3828 | 3836 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3829 | 3837 | if parmObj == None: |
|
3830 | 3838 | self.specGraphftpRTInoise.setCheckState(0) |
|
3831 | 3839 | else: |
|
3832 | 3840 | self.specGraphftpRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3833 | 3841 | |
|
3834 | 3842 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3835 | 3843 | if parmObj: |
|
3836 | 3844 | value = parmObj.getValue() |
|
3837 | 3845 | self.specGraphPath.setText(value) |
|
3838 | 3846 | |
|
3839 | 3847 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3840 | 3848 | if parmObj: |
|
3841 | 3849 | value = parmObj.getValue() |
|
3842 | 3850 | self.specGgraphftpratio.setText(str(value)) |
|
3843 | 3851 | |
|
3844 | 3852 | opObj = puObj.getOperationObj(name='SpectraWriter') |
|
3845 | 3853 | if opObj == None: |
|
3846 | 3854 | self.specOutputPath.clear() |
|
3847 | 3855 | self.specOutputblocksperfile.clear() |
|
3848 | 3856 | else: |
|
3849 | 3857 | value = opObj.getParameterObj(parameterName='path') |
|
3850 | 3858 | if value == None: |
|
3851 | 3859 | self.specOutputPath.clear() |
|
3852 | 3860 | else: |
|
3853 | 3861 | value = opObj.getParameterValue(parameterName='path') |
|
3854 | 3862 | path = str(value) |
|
3855 | 3863 | self.specOutputPath.setText(path) |
|
3856 | 3864 | value = opObj.getParameterObj(parameterName='blocksPerFile') |
|
3857 | 3865 | if value == None: |
|
3858 | 3866 | self.specOutputblocksperfile.clear() |
|
3859 | 3867 | else: |
|
3860 | 3868 | value = opObj.getParameterValue(parameterName='blocksPerFile') |
|
3861 | 3869 | blocksperfile = str(value) |
|
3862 | 3870 | self.specOutputblocksperfile.setText(blocksperfile) |
|
3863 | 3871 | |
|
3864 | 3872 | return |
|
3865 | 3873 | |
|
3866 | 3874 | def __refreshSpectraHeisWindow(self, puObj): |
|
3867 | 3875 | |
|
3868 | 3876 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") |
|
3869 | 3877 | if opObj == None: |
|
3870 | 3878 | self.specHeisOpIncoherent.clear() |
|
3871 | 3879 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
3872 | 3880 | else: |
|
3873 | 3881 | for parmObj in opObj.getParameterObjList(): |
|
3874 | 3882 | if parmObj.name == 'timeInterval': |
|
3875 | 3883 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3876 | 3884 | self.specHeisOpIncoherent.setText(str(value)) |
|
3877 | 3885 | self.specHeisOpIncoherent.setEnabled(True) |
|
3878 | 3886 | self.specHeisOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3879 | 3887 | self.specHeisOpCobIncInt.setCurrentIndex(0) |
|
3880 | 3888 | |
|
3881 | 3889 | # SpectraHeis Graph |
|
3882 | 3890 | |
|
3883 | 3891 | self.specHeisGgraphXminXmax.clear() |
|
3884 | 3892 | self.specHeisGgraphYminYmax.clear() |
|
3885 | 3893 | |
|
3886 | 3894 | self.specHeisGgraphChannelList.clear() |
|
3887 | 3895 | self.specHeisGgraphTminTmax.clear() |
|
3888 | 3896 | self.specHeisGgraphTimeRange.clear() |
|
3889 | 3897 | self.specHeisGgraphftpratio.clear() |
|
3890 | 3898 | |
|
3891 | 3899 | opObj = puObj.getOperationObj(name='SpectraHeisScope') |
|
3892 | 3900 | if opObj == None: |
|
3893 | 3901 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
3894 | 3902 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3895 | 3903 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3896 | 3904 | else: |
|
3897 | 3905 | operationSpectraHeisScope = "Enable" |
|
3898 | 3906 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3899 | 3907 | |
|
3900 | 3908 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3901 | 3909 | if parmObj == None: |
|
3902 | 3910 | self.specHeisGgraphChannelList.clear() |
|
3903 | 3911 | else: |
|
3904 | 3912 | value = opObj.getParameterValue(parameterName='channelList') |
|
3905 | 3913 | channelListSpectraHeisScope = str(value)[1:-1] |
|
3906 | 3914 | self.specHeisGgraphChannelList.setText(channelListSpectraHeisScope) |
|
3907 | 3915 | self.specHeisGgraphChannelList.setEnabled(True) |
|
3908 | 3916 | |
|
3909 | 3917 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3910 | 3918 | if parmObj == None: |
|
3911 | 3919 | self.specHeisGgraphXminXmax.clear() |
|
3912 | 3920 | else: |
|
3913 | 3921 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3914 | 3922 | value1 = str(value1) |
|
3915 | 3923 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3916 | 3924 | value2 = str(value2) |
|
3917 | 3925 | value = value1 + "," + value2 |
|
3918 | 3926 | self.specHeisGgraphXminXmax.setText(value) |
|
3919 | 3927 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
3920 | 3928 | |
|
3921 | 3929 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3922 | 3930 | if parmObj == None: |
|
3923 | 3931 | self.specHeisGgraphYminYmax.clear() |
|
3924 | 3932 | else: |
|
3925 | 3933 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3926 | 3934 | value1 = str(value1) |
|
3927 | 3935 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3928 | 3936 | value2 = str(value2) |
|
3929 | 3937 | value = value1 + "," + value2 |
|
3930 | 3938 | self.specHeisGgraphYminYmax.setText(value) |
|
3931 | 3939 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3932 | 3940 | |
|
3933 | 3941 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3934 | 3942 | if parmObj == None: |
|
3935 | 3943 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3936 | 3944 | else: |
|
3937 | 3945 | self.specHeisGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3938 | 3946 | |
|
3939 | 3947 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3940 | 3948 | if parmObj == None: |
|
3941 | 3949 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3942 | 3950 | else: |
|
3943 | 3951 | self.specHeisGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3944 | 3952 | |
|
3945 | 3953 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3946 | 3954 | if parmObj: |
|
3947 | 3955 | value = parmObj.getValue() |
|
3948 | 3956 | self.specHeisGraphPath.setText(value) |
|
3949 | 3957 | |
|
3950 | 3958 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3951 | 3959 | if parmObj: |
|
3952 | 3960 | value = parmObj.getValue() |
|
3953 | 3961 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3954 | 3962 | |
|
3955 | 3963 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') |
|
3956 | 3964 | |
|
3957 | 3965 | if opObj == None: |
|
3958 | 3966 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
3959 | 3967 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3960 | 3968 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3961 | 3969 | else: |
|
3962 | 3970 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3963 | 3971 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3964 | 3972 | if parmObj == None: |
|
3965 | 3973 | self.specHeisGgraphChannelList.clear() |
|
3966 | 3974 | else: |
|
3967 | 3975 | value = opObj.getParameterValue(parameterName='channelList') |
|
3968 | 3976 | channelListRTIPlot = str(value)[1:-1] |
|
3969 | 3977 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3970 | 3978 | self.specGgraphChannelList.setEnabled(True) |
|
3971 | 3979 | |
|
3972 | 3980 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3973 | 3981 | if parmObj == None: |
|
3974 | 3982 | self.specHeisGgraphTminTmax.clear() |
|
3975 | 3983 | else: |
|
3976 | 3984 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3977 | 3985 | value1 = str(value1) |
|
3978 | 3986 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3979 | 3987 | value2 = str(value2) |
|
3980 | 3988 | value = value1 + "," + value2 |
|
3981 | 3989 | self.specHeisGgraphTminTmax.setText(value) |
|
3982 | 3990 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
3983 | 3991 | |
|
3984 | 3992 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3985 | 3993 | if parmObj == None: |
|
3986 | 3994 | self.specGgraphTimeRange.clear() |
|
3987 | 3995 | else: |
|
3988 | 3996 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3989 | 3997 | value1 = str(value1) |
|
3990 | 3998 | self.specHeisGgraphTimeRange.setText(value1) |
|
3991 | 3999 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
3992 | 4000 | |
|
3993 | 4001 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3994 | 4002 | if parmObj == None: |
|
3995 | 4003 | self.specHeisGgraphYminYmax.clear() |
|
3996 | 4004 | else: |
|
3997 | 4005 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3998 | 4006 | value1 = str(value1) |
|
3999 | 4007 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
4000 | 4008 | value2 = str(value2) |
|
4001 | 4009 | value = value1 + "," + value2 |
|
4002 | 4010 | self.specHeisGgraphYminYmax.setText(value) |
|
4003 | 4011 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
4004 | 4012 | |
|
4005 | 4013 | parmObj = opObj.getParameterObj(parameterName="save") |
|
4006 | 4014 | if parmObj == None: |
|
4007 | 4015 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
4008 | 4016 | else: |
|
4009 | 4017 | self.specHeisGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
4010 | 4018 | |
|
4011 | 4019 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
4012 | 4020 | if parmObj == None: |
|
4013 | 4021 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
4014 | 4022 | else: |
|
4015 | 4023 | self.specHeisGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
4016 | 4024 | |
|
4017 | 4025 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
4018 | 4026 | if parmObj: |
|
4019 | 4027 | value = parmObj.getValue() |
|
4020 | 4028 | self.specHeisGraphPath.setText(value) |
|
4021 | 4029 | |
|
4022 | 4030 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
4023 | 4031 | if parmObj: |
|
4024 | 4032 | value = parmObj.getValue() |
|
4025 | 4033 | self.specHeisGgraphftpratio.setText(str(value)) |
|
4026 | 4034 | |
|
4027 | 4035 | # outputSpectraHeisWrite |
|
4028 | 4036 | opObj = puObj.getOperationObj(name='FitsWriter') |
|
4029 | 4037 | if opObj == None: |
|
4030 | 4038 | self.specHeisOutputPath.clear() |
|
4031 | 4039 | self.specHeisOutputblocksperfile.clear() |
|
4032 | 4040 | self.specHeisOutputMetada.clear() |
|
4033 | 4041 | else: |
|
4034 | 4042 | value = opObj.getParameterObj(parameterName='path') |
|
4035 | 4043 | if value == None: |
|
4036 | 4044 | self.specHeisOutputPath.clear() |
|
4037 | 4045 | else: |
|
4038 | 4046 | value = opObj.getParameterValue(parameterName='path') |
|
4039 | 4047 | path = str(value) |
|
4040 | 4048 | self.specHeisOutputPath.setText(path) |
|
4041 | 4049 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') |
|
4042 | 4050 | if value == None: |
|
4043 | 4051 | self.specHeisOutputblocksperfile.clear() |
|
4044 | 4052 | else: |
|
4045 | 4053 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') |
|
4046 | 4054 | blocksperfile = str(value) |
|
4047 | 4055 | self.specHeisOutputblocksperfile.setText(blocksperfile) |
|
4048 | 4056 | value = opObj.getParameterObj(parameterName='metadatafile') |
|
4049 | 4057 | if value == None: |
|
4050 | 4058 | self.specHeisOutputMetada.clear() |
|
4051 | 4059 | else: |
|
4052 | 4060 | value = opObj.getParameterValue(parameterName='metadatafile') |
|
4053 | 4061 | metadata_file = str(value) |
|
4054 | 4062 | self.specHeisOutputMetada.setText(metadata_file) |
|
4055 | 4063 | |
|
4056 | 4064 | return |
|
4057 | 4065 | |
|
4058 | 4066 | def __refreshCorrelationWindow(self, puObj): |
|
4059 | 4067 | pass |
|
4060 | 4068 | |
|
4061 | 4069 | def refreshPUWindow(self, puObj): |
|
4062 | 4070 | |
|
4063 | 4071 | if puObj.datatype == 'Voltage': |
|
4064 | 4072 | self.__refreshVoltageWindow(puObj) |
|
4065 | 4073 | |
|
4066 | 4074 | if puObj.datatype == 'Spectra': |
|
4067 | 4075 | self.__refreshSpectraWindow(puObj) |
|
4068 | 4076 | |
|
4069 | 4077 | if puObj.datatype == 'SpectraHeis': |
|
4070 | 4078 | self.__refreshSpectraHeisWindow(puObj) |
|
4071 | 4079 | |
|
4072 | 4080 | def refreshProjectProperties(self, projectObjView): |
|
4073 | 4081 | |
|
4074 | 4082 | propertyBuffObj = PropertyBuffer() |
|
4075 | 4083 | name = projectObjView.name |
|
4076 | 4084 | |
|
4077 | 4085 | propertyBuffObj.append("Properties", "Name", projectObjView.name), |
|
4078 | 4086 | propertyBuffObj.append("Properties", "Description", projectObjView.description) |
|
4079 | 4087 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) |
|
4080 | 4088 | |
|
4081 | 4089 | readUnitObj = projectObjView.getReadUnitObj() |
|
4082 | 4090 | runOperationObj = readUnitObj.getOperationObj(name='run') |
|
4083 | 4091 | |
|
4084 | 4092 | for thisParmObj in runOperationObj.getParameterObjList(): |
|
4085 | 4093 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) |
|
4086 | 4094 | |
|
4087 | 4095 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
4088 | 4096 | |
|
4089 | 4097 | self.treeProjectProperties.setModel(propertiesModel) |
|
4090 | 4098 | self.treeProjectProperties.expandAll() |
|
4091 | 4099 | self.treeProjectProperties.resizeColumnToContents(0) |
|
4092 | 4100 | self.treeProjectProperties.resizeColumnToContents(1) |
|
4093 | 4101 | |
|
4094 | 4102 | def refreshPUProperties(self, puObjView): |
|
4095 | 4103 | |
|
4096 | 4104 | ############ FTP CONFIG ################################ |
|
4097 | 4105 | #Deleting FTP Conf. This processing unit have not got any |
|
4098 | 4106 | #FTP configuration by default |
|
4099 | 4107 | if puObjView.id in self.__puLocalFolder2FTP.keys(): |
|
4100 | 4108 | self.__puLocalFolder2FTP.pop(puObjView.id) |
|
4101 | 4109 | ######################################################## |
|
4102 | 4110 | |
|
4103 | 4111 | propertyBuffObj = PropertyBuffer() |
|
4104 | 4112 | |
|
4105 | 4113 | for thisOp in puObjView.getOperationObjList(): |
|
4106 | 4114 | |
|
4107 | 4115 | operationName = thisOp.name |
|
4108 | 4116 | |
|
4109 | 4117 | if operationName == 'run': |
|
4110 | 4118 | operationName = 'Properties' |
|
4111 | 4119 | |
|
4112 | 4120 | else: |
|
4113 | 4121 | if not thisOp.getParameterObjList(): |
|
4114 | 4122 | propertyBuffObj.append(operationName, '--', '--') |
|
4115 | 4123 | continue |
|
4116 | 4124 | |
|
4117 | 4125 | for thisParmObj in thisOp.getParameterObjList(): |
|
4118 | 4126 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) |
|
4119 | 4127 | |
|
4120 | 4128 | ############ FTP CONFIG ################################ |
|
4121 | 4129 | if thisParmObj.name == "ftp_wei" and thisParmObj.getValue(): |
|
4122 | 4130 | value = thisParmObj.getValue() |
|
4123 | 4131 | self.temporalFTP.ftp_wei = value |
|
4124 | 4132 | |
|
4125 | 4133 | if thisParmObj.name == "exp_code" and thisParmObj.getValue(): |
|
4126 | 4134 | value = thisParmObj.getValue() |
|
4127 | 4135 | self.temporalFTP.exp_code = value |
|
4128 | 4136 | |
|
4129 | 4137 | if thisParmObj.name == "sub_exp_code" and thisParmObj.getValue(): |
|
4130 | 4138 | value = thisParmObj.getValue() |
|
4131 | 4139 | self.temporalFTP.sub_exp_code = value |
|
4132 | 4140 | |
|
4133 | 4141 | if thisParmObj.name == "plot_pos" and thisParmObj.getValue(): |
|
4134 | 4142 | value = thisParmObj.getValue() |
|
4135 | 4143 | self.temporalFTP.plot_pos = value |
|
4136 | 4144 | |
|
4137 | 4145 | if thisParmObj.name == 'ftp' and thisParmObj.getValue(): |
|
4138 | 4146 | figpathObj = thisOp.getParameterObj('figpath') |
|
4139 | 4147 | if figpathObj: |
|
4140 | 4148 | self.__puLocalFolder2FTP[puObjView.id] = figpathObj.getValue() |
|
4141 | 4149 | |
|
4142 | 4150 | ######################################################## |
|
4143 | 4151 | |
|
4144 | 4152 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
4145 | 4153 | |
|
4146 | 4154 | self.treeProjectProperties.setModel(propertiesModel) |
|
4147 | 4155 | self.treeProjectProperties.expandAll() |
|
4148 | 4156 | self.treeProjectProperties.resizeColumnToContents(0) |
|
4149 | 4157 | self.treeProjectProperties.resizeColumnToContents(1) |
|
4150 | 4158 | |
|
4151 | 4159 | def refreshGraphicsId(self): |
|
4152 | 4160 | |
|
4153 | 4161 | projectObj = self.getSelectedProjectObj() |
|
4154 | 4162 | |
|
4155 | 4163 | if not projectObj: |
|
4156 | 4164 | return |
|
4157 | 4165 | |
|
4158 | 4166 | for idPU, puObj in projectObj.procUnitConfObjDict.items(): |
|
4159 | 4167 | |
|
4160 | 4168 | for opObj in puObj.getOperationObjList(): |
|
4161 | 4169 | |
|
4162 | 4170 | if opObj.name not in ('Scope', 'SpectraPlot', 'CrossSpectraPlot', 'RTIPlot', 'CoherenceMap', 'PowerProfilePlot', 'Noise', 'SpectraHeisScope', 'RTIfromSpectraHeis'): |
|
4163 | 4171 | continue |
|
4164 | 4172 | |
|
4165 | 4173 | opObj.changeParameter(name='id', value=opObj.id, format='int') |
|
4166 | 4174 | |
|
4167 | 4175 | def on_click(self, index): |
|
4168 | 4176 | |
|
4169 | 4177 | self._disable_save_button() |
|
4170 | 4178 | self._disable_play_button() |
|
4171 | 4179 | |
|
4172 | 4180 | self.console.clear() |
|
4173 | 4181 | |
|
4174 | 4182 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) |
|
4175 | 4183 | |
|
4176 | 4184 | projectObjView = self.getSelectedProjectObj() |
|
4177 | 4185 | |
|
4178 | 4186 | if not projectObjView: |
|
4179 | 4187 | return |
|
4180 | 4188 | |
|
4181 | 4189 | self.create = False |
|
4182 | 4190 | selectedObjView = self.getSelectedItemObj() |
|
4183 | 4191 | |
|
4184 | 4192 | self.refreshProjectWindow(projectObjView) |
|
4185 | 4193 | self.refreshProjectProperties(projectObjView) |
|
4186 | 4194 | |
|
4187 | 4195 | #A project has been selected |
|
4188 | 4196 | if projectObjView == selectedObjView: |
|
4189 | 4197 | |
|
4190 | 4198 | self.tabProject.setEnabled(True) |
|
4191 | 4199 | self.tabVoltage.setEnabled(False) |
|
4192 | 4200 | self.tabSpectra.setEnabled(False) |
|
4193 | 4201 | self.tabCorrelation.setEnabled(False) |
|
4194 | 4202 | self.tabSpectraHeis.setEnabled(False) |
|
4195 | 4203 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4196 | 4204 | |
|
4197 | 4205 | if self.dateList: |
|
4198 | 4206 | self._enable_save_button() |
|
4199 | 4207 | self._enable_play_button() |
|
4200 | 4208 | |
|
4201 | 4209 | return |
|
4202 | 4210 | |
|
4203 | 4211 | #A processing unit has been selected |
|
4204 | 4212 | voltEnable = False |
|
4205 | 4213 | specEnable = False |
|
4206 | 4214 | corrEnable = False |
|
4207 | 4215 | specHeisEnable = False |
|
4208 | 4216 | tabSelected = self.tabProject |
|
4209 | 4217 | |
|
4210 | 4218 | puObj = selectedObjView |
|
4211 | 4219 | |
|
4212 | 4220 | self.refreshPUWindow(puObj) |
|
4213 | 4221 | self.refreshPUProperties(puObj) |
|
4214 | 4222 | self.showtabPUCreated(puObj.datatype) |
|
4215 | 4223 | |
|
4216 | 4224 | if self.dateList: |
|
4217 | 4225 | self._enable_save_button() |
|
4218 | 4226 | self._enable_play_button() |
|
4219 | 4227 | |
|
4220 | 4228 | def on_right_click(self, pos): |
|
4221 | 4229 | |
|
4222 | 4230 | self.menu = QtGui.QMenu() |
|
4223 | 4231 | quitAction0 = self.menu.addAction("Create a New Project") |
|
4224 | 4232 | quitAction1 = self.menu.addAction("Create a New Processing Unit") |
|
4225 | 4233 | quitAction2 = self.menu.addAction("Delete Item") |
|
4226 | 4234 | quitAction3 = self.menu.addAction("Quit") |
|
4227 | 4235 | |
|
4228 | 4236 | if len(self.__itemTreeDict) == 0: |
|
4229 | 4237 | quitAction2.setEnabled(False) |
|
4230 | 4238 | else: |
|
4231 | 4239 | quitAction2.setEnabled(True) |
|
4232 | 4240 | |
|
4233 | 4241 | action = self.menu.exec_(self.mapToGlobal(pos)) |
|
4234 | 4242 | |
|
4235 | 4243 | if action == quitAction0: |
|
4236 | 4244 | self. setInputsProject_View() |
|
4237 | 4245 | self.create = True |
|
4238 | 4246 | |
|
4239 | 4247 | if action == quitAction1: |
|
4240 | 4248 | if len(self.__projectObjDict) == 0: |
|
4241 | 4249 | outputstr = "You need to create a Project before adding a Processing Unit" |
|
4242 | 4250 | self.console.clear() |
|
4243 | 4251 | self.console.append(outputstr) |
|
4244 | 4252 | return 0 |
|
4245 | 4253 | else: |
|
4246 | 4254 | self.addPUWindow() |
|
4247 | 4255 | self.console.clear() |
|
4248 | 4256 | self.console.append("Please, Choose the type of Processing Unit") |
|
4249 | 4257 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
4250 | 4258 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
4251 | 4259 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
4252 | 4260 | |
|
4253 | 4261 | if action == quitAction2: |
|
4254 | 4262 | index = self.selectedItemTree |
|
4255 | 4263 | try: |
|
4256 | 4264 | index.parent() |
|
4257 | 4265 | except: |
|
4258 | 4266 | self.console.append('Please, first at all select a Project or Processing Unit') |
|
4259 | 4267 | return 0 |
|
4260 | 4268 | # print index.parent(),index |
|
4261 | 4269 | if index.parent() == None: |
|
4262 | 4270 | self.projectExplorerModel.removeRow(index.row()) |
|
4263 | 4271 | else: |
|
4264 | 4272 | index.parent().removeRow(index.row()) |
|
4265 | 4273 | self.removeItemTreeFromProject() |
|
4266 | 4274 | self.console.clear() |
|
4267 | 4275 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): |
|
4268 | 4276 | # print i.row() |
|
4269 | 4277 | |
|
4270 | 4278 | if action == quitAction3: |
|
4271 | 4279 | self.close() |
|
4272 | 4280 | return 0 |
|
4273 | 4281 | |
|
4274 | 4282 | def createProjectView(self, id): |
|
4275 | 4283 | |
|
4276 | 4284 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4277 | 4285 | id = str(id) |
|
4278 | 4286 | projectParms = self.__getParmsFromProjectWindow() |
|
4279 | 4287 | |
|
4280 | 4288 | if not projectParms.isValid(): |
|
4281 | 4289 | return None |
|
4282 | 4290 | |
|
4283 | 4291 | projectObjView = Project() |
|
4284 | 4292 | projectObjView.setup(id=id, name=projectParms.name, description=projectParms.description) |
|
4285 | 4293 | |
|
4286 | 4294 | self.__projectObjDict[id] = projectObjView |
|
4287 | 4295 | self.addProject2ProjectExplorer(id=id, name=projectObjView.name) |
|
4288 | 4296 | |
|
4289 | 4297 | return projectObjView |
|
4290 | 4298 | |
|
4291 | 4299 | def updateProjectView(self): |
|
4292 | 4300 | |
|
4293 | 4301 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4294 | 4302 | |
|
4295 | 4303 | projectParms = self.__getParmsFromProjectWindow() |
|
4296 | 4304 | |
|
4297 | 4305 | if not projectParms.isValid(): |
|
4298 | 4306 | return None |
|
4299 | 4307 | |
|
4300 | 4308 | projectObjView = self.getSelectedProjectObj() |
|
4301 | 4309 | |
|
4302 | 4310 | if not projectObjView: |
|
4303 | 4311 | self.console.append("Please select a project before update it") |
|
4304 | 4312 | return None |
|
4305 | 4313 | |
|
4306 | 4314 | projectObjView.update(name=projectParms.name, description=projectParms.description) |
|
4307 | 4315 | |
|
4308 | 4316 | return projectObjView |
|
4309 | 4317 | |
|
4310 | 4318 | def createReadUnitView(self, projectObjView, idReadUnit=None): |
|
4311 | 4319 | |
|
4312 | 4320 | projectParms = self.__getParmsFromProjectWindow() |
|
4313 | 4321 | |
|
4314 | 4322 | if not projectParms.isValid(): |
|
4315 | 4323 | return None |
|
4316 | 4324 | |
|
4317 | 4325 | if projectParms.datatype in ("Voltage", "Spectra", "Fits"): |
|
4318 | 4326 | readUnitConfObj = projectObjView.addReadUnit(id=idReadUnit, |
|
4319 | 4327 | datatype=projectParms.datatype, |
|
4320 | 4328 | path=projectParms.dpath, |
|
4321 | 4329 | startDate=projectParms.startDate, |
|
4322 | 4330 | endDate=projectParms.endDate, |
|
4323 | 4331 | startTime=projectParms.startTime, |
|
4324 | 4332 | endTime=projectParms.endTime, |
|
4325 | 4333 | online=projectParms.online, |
|
4326 | 4334 | walk=projectParms.walk |
|
4327 | 4335 | ) |
|
4328 | 4336 | |
|
4329 | 4337 | if projectParms.set: |
|
4330 | 4338 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4331 | 4339 | |
|
4332 | 4340 | if projectParms.delay: |
|
4333 | 4341 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4334 | 4342 | |
|
4335 | 4343 | if projectParms.expLabel: |
|
4336 | 4344 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) |
|
4337 | 4345 | |
|
4338 | 4346 | readUnitConfObj.addOperation(name="printInfo") |
|
4339 | 4347 | |
|
4340 | 4348 | if projectParms.datatype == "USRP": |
|
4341 | 4349 | readUnitConfObj = projectObjView.addReadUnit(id=idReadUnit, |
|
4342 | 4350 | datatype=projectParms.datatype, |
|
4343 | 4351 | path=projectParms.dpath, |
|
4344 | 4352 | startDate=projectParms.startDate, |
|
4345 | 4353 | endDate=projectParms.endDate, |
|
4346 | 4354 | startTime=projectParms.startTime, |
|
4347 | 4355 | endTime=projectParms.endTime, |
|
4348 | 4356 | online=projectParms.online, |
|
4349 | 4357 | ippKm=projectParms.ippKm |
|
4350 | 4358 | ) |
|
4351 | 4359 | |
|
4352 | 4360 | if projectParms.delay: |
|
4353 | 4361 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4354 | 4362 | |
|
4355 | 4363 | return readUnitConfObj |
|
4356 | 4364 | |
|
4357 | 4365 | def updateReadUnitView(self, projectObjView, idReadUnit): |
|
4358 | 4366 | |
|
4359 | 4367 | projectObjView.removeProcUnit(idReadUnit) |
|
4360 | 4368 | |
|
4361 | 4369 | readUnitConfObj = self.createReadUnitView(projectObjView, idReadUnit) |
|
4362 | 4370 | |
|
4363 | 4371 | return readUnitConfObj |
|
4364 | 4372 | |
|
4365 | 4373 | def createProcUnitView(self, projectObjView, datatype, inputId): |
|
4366 | 4374 | |
|
4367 | 4375 | procUnitConfObj = projectObjView.addProcUnit(datatype=datatype, inputId=inputId) |
|
4368 | 4376 | |
|
4369 | 4377 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4370 | 4378 | |
|
4371 | 4379 | return procUnitConfObj |
|
4372 | 4380 | |
|
4373 | 4381 | def updateProcUnitView(self, id): |
|
4374 | 4382 | |
|
4375 | 4383 | pass |
|
4376 | 4384 | |
|
4377 | 4385 | def addPUWindow(self): |
|
4378 | 4386 | |
|
4379 | 4387 | self.configUPWindowObj = UnitProcessWindow(self) |
|
4380 | 4388 | fatherObj = self.getSelectedItemObj() |
|
4381 | 4389 | try: |
|
4382 | 4390 | fatherObj.getElementName() |
|
4383 | 4391 | except: |
|
4384 | 4392 | self.console.append("First left click on Project or Processing Unit") |
|
4385 | 4393 | return 0 |
|
4386 | 4394 | |
|
4387 | 4395 | if fatherObj.getElementName() == 'Project': |
|
4388 | 4396 | readUnitConfObj = fatherObj.getReadUnitObj() |
|
4389 | 4397 | self.configUPWindowObj.dataTypeProject = str(readUnitConfObj.datatype) |
|
4390 | 4398 | |
|
4391 | 4399 | self.configUPWindowObj.getfromWindowList.append(fatherObj) |
|
4392 | 4400 | self.configUPWindowObj.loadTotalList() |
|
4393 | 4401 | self.configUPWindowObj.show() |
|
4394 | 4402 | self.configUPWindowObj.closed.connect(self.createPUWindow) |
|
4395 | 4403 | |
|
4396 | 4404 | def createPUWindow(self): |
|
4397 | 4405 | |
|
4398 | 4406 | if not self.configUPWindowObj.create: |
|
4399 | 4407 | return |
|
4400 | 4408 | |
|
4401 | 4409 | fatherObj = self.configUPWindowObj.getFromWindow |
|
4402 | 4410 | datatype = self.configUPWindowObj.typeofUP |
|
4403 | 4411 | |
|
4404 | 4412 | if fatherObj.getElementName() == 'Project': |
|
4405 | 4413 | inputId = fatherObj.getReadUnitId() |
|
4406 | 4414 | projectObjView = fatherObj |
|
4407 | 4415 | else: |
|
4408 | 4416 | inputId = fatherObj.getId() |
|
4409 | 4417 | projectObjView = self.getSelectedProjectObj() |
|
4410 | 4418 | |
|
4411 | 4419 | if not projectObjView: |
|
4412 | 4420 | return |
|
4413 | 4421 | |
|
4414 | 4422 | puObj = self.createProcUnitView(projectObjView, datatype, inputId) |
|
4415 | 4423 | |
|
4416 | 4424 | self.addPU2ProjectExplorer(puObj) |
|
4417 | 4425 | |
|
4418 | 4426 | self.showtabPUCreated(datatype) |
|
4419 | 4427 | |
|
4420 | 4428 | self.clearPUWindow(datatype) |
|
4421 | 4429 | |
|
4422 | 4430 | self.showPUinitView() |
|
4423 | 4431 | |
|
4424 | 4432 | def addFTPConf2Operation(self, puObj, opObj): |
|
4425 | 4433 | |
|
4426 | 4434 | if not self.temporalFTP.create: |
|
4427 | 4435 | self.temporalFTP.setwithoutconfiguration() |
|
4428 | 4436 | |
|
4429 | 4437 | # opObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4430 | 4438 | # opObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4431 | 4439 | # opObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4432 | 4440 | # opObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4433 | 4441 | |
|
4434 | 4442 | if self.temporalFTP.ftp_wei: |
|
4435 | 4443 | opObj.addParameter(name='ftp_wei', value=int(self.temporalFTP.ftp_wei), format='int') |
|
4436 | 4444 | if self.temporalFTP.exp_code: |
|
4437 | 4445 | opObj.addParameter(name='exp_code', value=int(self.temporalFTP.exp_code), format='int') |
|
4438 | 4446 | if self.temporalFTP.sub_exp_code: |
|
4439 | 4447 | opObj.addParameter(name='sub_exp_code', value=int(self.temporalFTP.sub_exp_code), format='int') |
|
4440 | 4448 | if self.temporalFTP.plot_pos: |
|
4441 | 4449 | opObj.addParameter(name='plot_pos', value=int(self.temporalFTP.plot_pos), format='int') |
|
4442 | 4450 | |
|
4443 | 4451 | # def __checkFTPProcUnit(self, projectObj, localfolder): |
|
4444 | 4452 | # |
|
4445 | 4453 | # puId = None |
|
4446 | 4454 | # puObj = None |
|
4447 | 4455 | # |
|
4448 | 4456 | # for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4449 | 4457 | # |
|
4450 | 4458 | # if not thisPuObj.name == "SendToServer": |
|
4451 | 4459 | # continue |
|
4452 | 4460 | # |
|
4453 | 4461 | # opObj = thisPuObj.getOperationObj(name='run') |
|
4454 | 4462 | # |
|
4455 | 4463 | # parmObj = opObj.getParameterObj('localfolder') |
|
4456 | 4464 | # |
|
4457 | 4465 | # #localfolder parameter should always be set, if it is not set then ProcUnit should be removed |
|
4458 | 4466 | # if not parmObj: |
|
4459 | 4467 | # projectObj.removeProcUnit(thisPuId) |
|
4460 | 4468 | # continue |
|
4461 | 4469 | # |
|
4462 | 4470 | # thisLocalfolder = parmObj.getValue() |
|
4463 | 4471 | # |
|
4464 | 4472 | # if localfolder != thisLocalfolder: |
|
4465 | 4473 | # continue |
|
4466 | 4474 | # |
|
4467 | 4475 | # puId = thisPuId |
|
4468 | 4476 | # puObj = thisPuObj |
|
4469 | 4477 | # break |
|
4470 | 4478 | # |
|
4471 | 4479 | # return puObj |
|
4472 | 4480 | |
|
4473 | 4481 | def createFTPProcUnitView(self): |
|
4474 | 4482 | |
|
4475 | 4483 | if not self.temporalFTP.create: |
|
4476 | 4484 | self.temporalFTP.setwithoutconfiguration() |
|
4477 | 4485 | |
|
4478 | 4486 | projectObj = self.getSelectedProjectObj() |
|
4479 | 4487 | |
|
4480 | 4488 | if not projectObj: |
|
4481 | 4489 | return |
|
4482 | 4490 | |
|
4483 | 4491 | self.removeAllFTPProcUnitView(projectObj) |
|
4484 | 4492 | |
|
4485 | 4493 | if not self.__puLocalFolder2FTP: |
|
4486 | 4494 | return |
|
4487 | 4495 | |
|
4488 | 4496 | folderList = ",".join(self.__puLocalFolder2FTP.values()) |
|
4489 | 4497 | |
|
4490 | 4498 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") |
|
4491 | 4499 | |
|
4492 | 4500 | procUnitConfObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4493 | 4501 | procUnitConfObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4494 | 4502 | procUnitConfObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4495 | 4503 | procUnitConfObj.addParameter(name='localfolder', value=folderList, format='list') |
|
4496 | 4504 | procUnitConfObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4497 | 4505 | procUnitConfObj.addParameter(name='ext', value=self.temporalFTP.extension, format='str') |
|
4498 | 4506 | procUnitConfObj.addParameter(name='period', value=self.temporalFTP.period, format='int') |
|
4499 | 4507 | procUnitConfObj.addParameter(name='protocol', value=self.temporalFTP.protocol, format='str') |
|
4500 | 4508 | |
|
4501 | 4509 | procUnitConfObj.addParameter(name='ftp_wei', value=self.temporalFTP.ftp_wei, format='int') |
|
4502 | 4510 | procUnitConfObj.addParameter(name='exp_code', value=self.temporalFTP.exp_code, format='int') |
|
4503 | 4511 | procUnitConfObj.addParameter(name='sub_exp_code', value=self.temporalFTP.sub_exp_code, format='int') |
|
4504 | 4512 | procUnitConfObj.addParameter(name='plot_pos', value=self.temporalFTP.plot_pos, format='int') |
|
4505 | 4513 | |
|
4506 | 4514 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4507 | 4515 | |
|
4508 | 4516 | def removeAllFTPProcUnitView(self, projectObj): |
|
4509 | 4517 | |
|
4510 | 4518 | for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4511 | 4519 | |
|
4512 | 4520 | if not thisPuObj.name == "SendToServer": |
|
4513 | 4521 | continue |
|
4514 | 4522 | |
|
4515 | 4523 | projectObj.removeProcUnit(thisPuId) |
|
4516 | 4524 | |
|
4517 | 4525 | if thisPuId not in self.__puObjDict.keys(): |
|
4518 | 4526 | continue |
|
4519 | 4527 | |
|
4520 | 4528 | self.__puObjDict.pop(thisPuId) |
|
4521 | 4529 | |
|
4522 | 4530 | def showPUinitView(self): |
|
4523 | 4531 | |
|
4524 | 4532 | self.propertiesModel = TreeModel() |
|
4525 | 4533 | self.propertiesModel.initPUVoltageView() |
|
4526 | 4534 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
4527 | 4535 | self.treeProjectProperties.expandAll() |
|
4528 | 4536 | self.treeProjectProperties.allColumnsShowFocus() |
|
4529 | 4537 | self.treeProjectProperties.resizeColumnToContents(1) |
|
4530 | 4538 | |
|
4531 | 4539 | def saveFTPFromOpObj(self, operationObj): |
|
4532 | 4540 | |
|
4533 | 4541 | if operationObj.name != "SendByFTP": |
|
4534 | 4542 | return |
|
4535 | 4543 | |
|
4536 | 4544 | server = operationObj.getParameterValue("server") |
|
4537 | 4545 | username = operationObj.getParameterValue("username") |
|
4538 | 4546 | password = operationObj.getParameterValue("password") |
|
4539 | 4547 | localfolder = operationObj.getParameterValue("localfolder") |
|
4540 | 4548 | remotefolder = operationObj.getParameterValue("remotefolder") |
|
4541 | 4549 | ext = operationObj.getParameterValue("ext") |
|
4542 | 4550 | period = operationObj.getParameterValue("period") |
|
4543 | 4551 | |
|
4544 | 4552 | self.temporalFTP.save(server=server, |
|
4545 | 4553 | remotefolder=remotefolder, |
|
4546 | 4554 | username=username, |
|
4547 | 4555 | password=password, |
|
4548 | 4556 | localfolder=localfolder, |
|
4549 | 4557 | extension=ext) |
|
4550 | 4558 | |
|
4551 | 4559 | return |
|
4552 | 4560 | |
|
4553 | 4561 | def saveFTPFromProcUnitObj(self, puObj): |
|
4554 | 4562 | |
|
4555 | 4563 | opObj = puObj.getOperationObj(name="run") |
|
4556 | 4564 | |
|
4557 | 4565 | parmObj = opObj.getParameterObj(parameterName="server") |
|
4558 | 4566 | if parmObj == None: |
|
4559 | 4567 | server = 'jro-app.igp.gob.pe' |
|
4560 | 4568 | else: |
|
4561 | 4569 | server = parmObj.getValue() |
|
4562 | 4570 | |
|
4563 | 4571 | parmObj = opObj.getParameterObj(parameterName="remotefolder") |
|
4564 | 4572 | if parmObj == None: |
|
4565 | 4573 | remotefolder = '/home/wmaster/graficos' |
|
4566 | 4574 | else: |
|
4567 | 4575 | remotefolder = parmObj.getValue() |
|
4568 | 4576 | |
|
4569 | 4577 | parmObj = opObj.getParameterObj(parameterName="username") |
|
4570 | 4578 | if parmObj == None: |
|
4571 | 4579 | username = 'wmaster' |
|
4572 | 4580 | else: |
|
4573 | 4581 | username = parmObj.getValue() |
|
4574 | 4582 | |
|
4575 | 4583 | parmObj = opObj.getParameterObj(parameterName="password") |
|
4576 | 4584 | if parmObj == None: |
|
4577 | 4585 | password = 'mst2010vhf' |
|
4578 | 4586 | else: |
|
4579 | 4587 | password = parmObj.getValue() |
|
4580 | 4588 | |
|
4581 | 4589 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
4582 | 4590 | if parmObj == None: |
|
4583 | 4591 | ftp_wei = 0 |
|
4584 | 4592 | else: |
|
4585 | 4593 | ftp_wei = parmObj.getValue() |
|
4586 | 4594 | |
|
4587 | 4595 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
4588 | 4596 | if parmObj == None: |
|
4589 | 4597 | exp_code = 0 |
|
4590 | 4598 | else: |
|
4591 | 4599 | exp_code = parmObj.getValue() |
|
4592 | 4600 | |
|
4593 | 4601 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
4594 | 4602 | if parmObj == None: |
|
4595 | 4603 | sub_exp_code = 0 |
|
4596 | 4604 | else: |
|
4597 | 4605 | sub_exp_code = parmObj.getValue() |
|
4598 | 4606 | |
|
4599 | 4607 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
4600 | 4608 | if parmObj == None: |
|
4601 | 4609 | plot_pos = 0 |
|
4602 | 4610 | else: |
|
4603 | 4611 | plot_pos = parmObj.getValue() |
|
4604 | 4612 | |
|
4605 | 4613 | parmObj = opObj.getParameterObj(parameterName="localfolder") |
|
4606 | 4614 | if parmObj == None: |
|
4607 | 4615 | localfolder = None |
|
4608 | 4616 | else: |
|
4609 | 4617 | localfolder = parmObj.getValue() |
|
4610 | 4618 | |
|
4611 | 4619 | parmObj = opObj.getParameterObj(parameterName="ext") |
|
4612 | 4620 | if parmObj == None: |
|
4613 | 4621 | extension = '.png' |
|
4614 | 4622 | else: |
|
4615 | 4623 | extension = parmObj.getValue() |
|
4616 | 4624 | |
|
4617 | 4625 | self.temporalFTP.save(server=server, |
|
4618 | 4626 | remotefolder=remotefolder, |
|
4619 | 4627 | username=username, |
|
4620 | 4628 | password=password, |
|
4621 | 4629 | ftp_wei=ftp_wei, |
|
4622 | 4630 | exp_code=exp_code, |
|
4623 | 4631 | sub_exp_code=sub_exp_code, |
|
4624 | 4632 | plot_pos=plot_pos, |
|
4625 | 4633 | localfolder=localfolder, |
|
4626 | 4634 | extension=extension) |
|
4627 | 4635 | |
|
4628 | 4636 | def addProject2ProjectExplorer(self, id, name): |
|
4629 | 4637 | |
|
4630 | 4638 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4631 | 4639 | |
|
4632 | 4640 | parentItem = self.projectExplorerModel.invisibleRootItem() |
|
4633 | 4641 | parentItem.appendRow(itemTree) |
|
4634 | 4642 | |
|
4635 | 4643 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4636 | 4644 | |
|
4637 | 4645 | self.selectedItemTree = itemTree |
|
4638 | 4646 | |
|
4639 | 4647 | self.__itemTreeDict[id] = itemTree |
|
4640 | 4648 | |
|
4641 | 4649 | def addPU2ProjectExplorer(self, puObj): |
|
4642 | 4650 | |
|
4643 | 4651 | id, name = puObj.id, puObj.datatype |
|
4644 | 4652 | |
|
4645 | 4653 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4646 | 4654 | |
|
4647 | 4655 | parentItem = self.selectedItemTree |
|
4648 | 4656 | parentItem.appendRow(itemTree) |
|
4649 | 4657 | self.projectExplorerTree.expandAll() |
|
4650 | 4658 | |
|
4651 | 4659 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4652 | 4660 | |
|
4653 | 4661 | self.selectedItemTree = itemTree |
|
4654 | 4662 | |
|
4655 | 4663 | self.__itemTreeDict[id] = itemTree |
|
4656 | 4664 | |
|
4657 | 4665 | def addPU2PELoadXML(self, puObj): |
|
4658 | 4666 | |
|
4659 | 4667 | id, name, inputId = puObj.id, puObj.datatype, puObj.inputId |
|
4660 | 4668 | |
|
4661 | 4669 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4662 | 4670 | |
|
4663 | 4671 | if self.__itemTreeDict.has_key(inputId): |
|
4664 | 4672 | parentItem = self.__itemTreeDict[inputId] |
|
4665 | 4673 | else: |
|
4666 | 4674 | #If parent is a Reader object |
|
4667 | 4675 | parentItem = self.__itemTreeDict[id[:-1]] |
|
4668 | 4676 | |
|
4669 | 4677 | parentItem.appendRow(itemTree) |
|
4670 | 4678 | self.projectExplorerTree.expandAll() |
|
4671 | 4679 | parentItem = itemTree |
|
4672 | 4680 | self.projectExplorerTree.setCurrentIndex(parentItem.index()) |
|
4673 | 4681 | |
|
4674 | 4682 | self.__itemTreeDict[id] = itemTree |
|
4675 | 4683 | self.selectedItemTree = itemTree |
|
4676 | 4684 | |
|
4677 | 4685 | def getSelectedProjectObj(self): |
|
4678 | 4686 | """ |
|
4679 | 4687 | Return the current project object selected. If a processing unit is |
|
4680 | 4688 | actually selected this function returns associated project. |
|
4681 | 4689 | |
|
4682 | 4690 | None if any project or processing unit is selected |
|
4683 | 4691 | """ |
|
4684 | 4692 | for key in self.__itemTreeDict.keys(): |
|
4685 | 4693 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4686 | 4694 | continue |
|
4687 | 4695 | |
|
4688 | 4696 | if self.__projectObjDict.has_key(key): |
|
4689 | 4697 | projectObj = self.__projectObjDict[key] |
|
4690 | 4698 | return projectObj |
|
4691 | 4699 | |
|
4692 | 4700 | puObj = self.__puObjDict[key] |
|
4693 | 4701 | |
|
4694 | 4702 | if puObj.parentId == None: |
|
4695 | 4703 | projectId = puObj.getId()[0] |
|
4696 | 4704 | else: |
|
4697 | 4705 | projectId = puObj.parentId |
|
4698 | 4706 | |
|
4699 | 4707 | projectObj = self.__projectObjDict[projectId] |
|
4700 | 4708 | return projectObj |
|
4701 | 4709 | |
|
4702 | 4710 | return None |
|
4703 | 4711 | |
|
4704 | 4712 | def getSelectedItemObj(self): |
|
4705 | 4713 | """ |
|
4706 | 4714 | Return the current project or processing unit object selected |
|
4707 | 4715 | |
|
4708 | 4716 | None if any project or processing unit is selected |
|
4709 | 4717 | """ |
|
4710 | 4718 | for key in self.__itemTreeDict.keys(): |
|
4711 | 4719 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4712 | 4720 | continue |
|
4713 | 4721 | |
|
4714 | 4722 | if self.__projectObjDict.has_key(key) == True: |
|
4715 | 4723 | fatherObj = self.__projectObjDict[key] |
|
4716 | 4724 | else: |
|
4717 | 4725 | fatherObj = self.__puObjDict[key] |
|
4718 | 4726 | |
|
4719 | 4727 | return fatherObj |
|
4720 | 4728 | |
|
4721 | 4729 | return None |
|
4722 | 4730 | |
|
4723 | 4731 | def _WarningWindow(self, text, information): |
|
4724 | 4732 | |
|
4725 | 4733 | msgBox = QtGui.QMessageBox() |
|
4726 | 4734 | msgBox.setText(text) |
|
4727 | 4735 | msgBox.setInformativeText(information) |
|
4728 | 4736 | msgBox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) |
|
4729 | 4737 | msgBox.setDefaultButton(QtGui.QMessageBox.Ok) |
|
4730 | 4738 | ret = msgBox.exec_() |
|
4731 | 4739 | |
|
4732 | 4740 | answer = False |
|
4733 | 4741 | |
|
4734 | 4742 | if ret == QtGui.QMessageBox.Ok: |
|
4735 | 4743 | answer = True |
|
4736 | 4744 | |
|
4737 | 4745 | return answer |
|
4738 | 4746 | |
|
4739 | 4747 | def __getNewProjectId(self): |
|
4740 | 4748 | |
|
4741 | 4749 | loadProject = False |
|
4742 | 4750 | |
|
4743 | 4751 | for thisId in range(1,10): |
|
4744 | 4752 | newId = str(thisId) |
|
4745 | 4753 | if newId in self.__projectObjDict.keys(): |
|
4746 | 4754 | continue |
|
4747 | 4755 | |
|
4748 | 4756 | loadProject = True |
|
4749 | 4757 | projectId = newId |
|
4750 | 4758 | break |
|
4751 | 4759 | |
|
4752 | 4760 | if not loadProject: |
|
4753 | 4761 | self.console.clear() |
|
4754 | 4762 | self.console.append("The maximum number of projects has been loaded, a new project can not be loaded") |
|
4755 | 4763 | return None |
|
4756 | 4764 | |
|
4757 | 4765 | return projectId |
|
4758 | 4766 | |
|
4759 | 4767 | def openProject(self): |
|
4760 | 4768 | |
|
4761 | 4769 | self._disable_save_button() |
|
4762 | 4770 | self._disable_play_button() |
|
4763 | 4771 | |
|
4764 | 4772 | self.console.clear() |
|
4765 | 4773 | |
|
4766 | 4774 | self.frame_2.setEnabled(True) |
|
4767 | 4775 | |
|
4768 | 4776 | # print self.dir |
|
4769 | 4777 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open a project file", self.pathWorkSpace, self.tr("Html Files (*.xml)"))) |
|
4770 | 4778 | |
|
4771 | 4779 | projectObjLoad = Project() |
|
4772 | 4780 | |
|
4773 | 4781 | if not projectObjLoad.readXml(filename): |
|
4774 | 4782 | self.console.append("The selected xml file could not be loaded ...") |
|
4775 | 4783 | return 0 |
|
4776 | 4784 | |
|
4777 | 4785 | self.create = False |
|
4778 | 4786 | self.refreshProjectWindow(projectObjLoad) |
|
4779 | 4787 | self.refreshProjectProperties(projectObjLoad) |
|
4780 | 4788 | |
|
4781 | 4789 | projectId = projectObjLoad.id |
|
4782 | 4790 | |
|
4783 | 4791 | if projectId in self.__projectObjDict.keys(): |
|
4784 | 4792 | |
|
4785 | 4793 | projectId = self.__getNewProjectId() |
|
4786 | 4794 | |
|
4787 | 4795 | if not projectId: |
|
4788 | 4796 | return 0 |
|
4789 | 4797 | |
|
4790 | 4798 | projectObjLoad.updateId(projectId) |
|
4791 | 4799 | |
|
4792 | 4800 | self.__projectObjDict[projectId] = projectObjLoad |
|
4793 | 4801 | |
|
4794 | 4802 | self.addProject2ProjectExplorer(id=projectId, name=projectObjLoad.name) |
|
4795 | 4803 | |
|
4796 | 4804 | self.tabWidgetProject.setEnabled(True) |
|
4797 | 4805 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4798 | 4806 | # Disable tabProject after finish the creation |
|
4799 | 4807 | self.tabProject.setEnabled(True) |
|
4800 | 4808 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) |
|
4801 | 4809 | |
|
4802 | 4810 | for puId, puObj in puObjorderList.items(): |
|
4803 | 4811 | |
|
4804 | 4812 | self.__puObjDict[puId] = puObj |
|
4805 | 4813 | |
|
4806 | 4814 | if puObj.name == "SendToServer": |
|
4807 | 4815 | self.saveFTPFromProcUnitObj(puObj) |
|
4808 | 4816 | |
|
4809 | 4817 | ############## COMPATIBLE WITH OLD VERSIONS ################ |
|
4810 | 4818 | operationObj = puObj.getOperationObj("SendByFTP") |
|
4811 | 4819 | |
|
4812 | 4820 | if operationObj: |
|
4813 | 4821 | self.saveFTPFromOpObj(operationObj) |
|
4814 | 4822 | ############################################################ |
|
4815 | 4823 | |
|
4816 | 4824 | if puObj.inputId == '0': |
|
4817 | 4825 | continue |
|
4818 | 4826 | |
|
4819 | 4827 | self.addPU2PELoadXML(puObj) |
|
4820 | 4828 | |
|
4821 | 4829 | self.refreshPUWindow(puObj) |
|
4822 | 4830 | self.refreshPUProperties(puObj) |
|
4823 | 4831 | self.showtabPUCreated(datatype=puObj.datatype) |
|
4824 | 4832 | |
|
4825 | 4833 | # self.console.clear() |
|
4826 | 4834 | self.console.append("\nThe selected xml file has been loaded successfully") |
|
4827 | 4835 | |
|
4828 | 4836 | if self.dateList: |
|
4829 | 4837 | self._disable_save_button() |
|
4830 | 4838 | self._enable_play_button() |
|
4831 | 4839 | |
|
4832 | 4840 | def create_updating_timer(self): |
|
4833 | 4841 | |
|
4834 | 4842 | self.comm_data_timer = QtCore.QTimer(self) |
|
4835 | 4843 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) |
|
4836 | 4844 | self.comm_data_timer.start(1000) |
|
4837 | 4845 | |
|
4838 | 4846 | def on_comm_updating_timer(self): |
|
4839 | 4847 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose |
|
4840 | 4848 | # Si el proceso se ha parado actualizar el GUI (stopProject) |
|
4841 | 4849 | if not self.threadStarted: |
|
4842 | 4850 | return |
|
4843 | 4851 | |
|
4844 | 4852 | if self.controllerThread.isFinished(): |
|
4845 | 4853 | self.stopProject() |
|
4846 | 4854 | return |
|
4847 | 4855 | |
|
4848 | 4856 | def use_plotmanager(self, controllerThread): |
|
4849 | 4857 | |
|
4850 | 4858 | self.plotManager = controllerThread.useExternalPlotter() |
|
4851 | 4859 | |
|
4852 | 4860 | self.plot_timer = QtCore.QTimer() |
|
4853 | 4861 | self.plot_timer.timeout.connect(self.on_plotmanager_timer) |
|
4854 | 4862 | self.plot_timer.start(10) |
|
4855 | 4863 | |
|
4856 | 4864 | def on_plotmanager_timer(self): |
|
4857 | 4865 | |
|
4858 | 4866 | if not self.plotManager: |
|
4859 | 4867 | return |
|
4860 | 4868 | |
|
4861 | 4869 | self.plotManager.run() |
|
4862 | 4870 | |
|
4863 | 4871 | if self.plotManager.isErrorDetected(): |
|
4864 | 4872 | self.stopProject() |
|
4865 | 4873 | return |
|
4866 | 4874 | |
|
4867 | 4875 | def playProject(self, ext=".xml", save=1): |
|
4868 | 4876 | |
|
4869 | 4877 | self._disable_play_button() |
|
4870 | 4878 | self._disable_save_button() |
|
4871 | 4879 | |
|
4872 | 4880 | if self.controllerThread: |
|
4873 | 4881 | if self.controllerThread.isRunning(): |
|
4874 | 4882 | self.console.append("There is already another process running") |
|
4875 | 4883 | self._enable_stop_button() |
|
4876 | 4884 | return |
|
4877 | 4885 | |
|
4878 | 4886 | if not self.dateList: |
|
4879 | 4887 | self.console.append("No data found, check datapath") |
|
4880 | 4888 | |
|
4881 | 4889 | projectObj = self.getSelectedProjectObj() |
|
4882 | 4890 | |
|
4883 | 4891 | if not projectObj: |
|
4884 | 4892 | self.console.append("Please, select a project to start it") |
|
4885 | 4893 | return |
|
4886 | 4894 | |
|
4887 | 4895 | if save: |
|
4888 | 4896 | filename = self.saveProject() |
|
4889 | 4897 | if filename == None: |
|
4890 | 4898 | self.console.append("Process not initialized.") |
|
4891 | 4899 | return |
|
4892 | 4900 | else: |
|
4893 | 4901 | filename = TEMPORAL_FILE |
|
4894 | 4902 | projectObj.writeXml( os.path.join(self.pathWorkSpace,filename) ) |
|
4895 | 4903 | |
|
4896 | 4904 | self.console.clear() |
|
4897 | 4905 | self.console.append("Please wait...") |
|
4898 | 4906 | |
|
4899 | 4907 | self.controllerThread = ControllerThread() |
|
4900 | 4908 | self.controllerThread.readXml(filename) |
|
4901 | 4909 | |
|
4902 | 4910 | self.use_plotmanager(self.controllerThread) |
|
4903 | 4911 | |
|
4904 | 4912 | self.console.clear() |
|
4905 | 4913 | |
|
4906 | 4914 | self.controllerThread.start() |
|
4907 | 4915 | |
|
4908 | 4916 | sleep(0.5) |
|
4909 | 4917 | |
|
4910 | 4918 | |
|
4911 | 4919 | self.threadStarted = True |
|
4912 | 4920 | |
|
4913 | 4921 | self._disable_play_button() |
|
4914 | 4922 | self._disable_save_button() |
|
4915 | 4923 | self._enable_stop_button() |
|
4916 | 4924 | |
|
4917 | 4925 | def stopProject(self): |
|
4918 | 4926 | |
|
4919 | 4927 | self.threadStarted = False |
|
4920 | 4928 | self.controllerThread.stop() |
|
4921 | 4929 | self.plot_timer.stop() |
|
4922 | 4930 | |
|
4923 | 4931 | self.plotManager.join() |
|
4924 | 4932 | self.plotManager = None |
|
4925 | 4933 | |
|
4926 | 4934 | while self.controllerThread.isRunning(): |
|
4927 | 4935 | sleep(0.5) |
|
4928 | 4936 | |
|
4929 | 4937 | self._disable_stop_button() |
|
4930 | 4938 | self._enable_play_button() |
|
4931 | 4939 | |
|
4932 | 4940 | def pauseProject(self): |
|
4933 | 4941 | |
|
4934 | 4942 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) |
|
4935 | 4943 | paused = self.controllerThread.pause() |
|
4936 | 4944 | |
|
4937 | 4945 | self.changePauseIcon(paused) |
|
4938 | 4946 | |
|
4939 | 4947 | def saveProject(self, filename=None): |
|
4940 | 4948 | |
|
4941 | 4949 | self._disable_save_button() |
|
4942 | 4950 | self._disable_play_button() |
|
4943 | 4951 | |
|
4944 | 4952 | projectObj = self.getSelectedProjectObj() |
|
4945 | 4953 | |
|
4946 | 4954 | if not projectObj: |
|
4947 | 4955 | |
|
4948 | 4956 | if self.create: |
|
4949 | 4957 | self.console.append("Please press Ok before save it") |
|
4950 | 4958 | else: |
|
4951 | 4959 | self.console.append("Please select a project before save it") |
|
4952 | 4960 | return |
|
4953 | 4961 | |
|
4954 | 4962 | self.refreshGraphicsId() |
|
4955 | 4963 | |
|
4956 | 4964 | sts = True |
|
4957 | 4965 | selectedItemObj = self.getSelectedItemObj() |
|
4958 | 4966 | |
|
4959 | 4967 | #A Processing Unit has been selected |
|
4960 | 4968 | if projectObj == selectedItemObj: |
|
4961 | 4969 | if not self.on_proOk_clicked(): |
|
4962 | 4970 | return None |
|
4963 | 4971 | |
|
4964 | 4972 | #A Processing Unit has been selected |
|
4965 | 4973 | if projectObj != selectedItemObj: |
|
4966 | 4974 | puObj = selectedItemObj |
|
4967 | 4975 | |
|
4968 | 4976 | if puObj.name == 'VoltageProc': |
|
4969 | 4977 | sts = self.on_volOpOk_clicked() |
|
4970 | 4978 | if puObj.name == 'SpectraProc': |
|
4971 | 4979 | sts = self.on_specOpOk_clicked() |
|
4972 | 4980 | if puObj.name == 'SpectraHeisProc': |
|
4973 | 4981 | sts = self.on_specHeisOpOk_clicked() |
|
4974 | 4982 | |
|
4975 | 4983 | if not sts: |
|
4976 | 4984 | return None |
|
4977 | 4985 | |
|
4978 | 4986 | self.createFTPProcUnitView() |
|
4979 | 4987 | |
|
4980 | 4988 | if not filename: |
|
4981 | 4989 | filename = os.path.join( str(self.pathWorkSpace), "%s%s" %(str(projectObj.name), '.xml') ) |
|
4982 | 4990 | |
|
4983 | 4991 | projectObj.writeXml(filename) |
|
4984 | 4992 | self.console.clear() |
|
4985 | 4993 | self.console.append("Project saved") |
|
4986 | 4994 | self.console.append("Press Play button to start data processing ...") |
|
4987 | 4995 | |
|
4988 | 4996 | self._disable_save_button() |
|
4989 | 4997 | self._enable_play_button() |
|
4990 | 4998 | |
|
4991 | 4999 | return filename |
|
4992 | 5000 | |
|
4993 | 5001 | def removeItemTreeFromProject(self): |
|
4994 | 5002 | """ |
|
4995 | 5003 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol |
|
4996 | 5004 | """ |
|
4997 | 5005 | for key in self.__itemTreeDict.keys(): |
|
4998 | 5006 | |
|
4999 | 5007 | #Check again because an item can delete multiple items (childs) |
|
5000 | 5008 | if key not in self.__itemTreeDict.keys(): |
|
5001 | 5009 | continue |
|
5002 | 5010 | |
|
5003 | 5011 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
5004 | 5012 | continue |
|
5005 | 5013 | |
|
5006 | 5014 | if self.__projectObjDict.has_key(key) == True: |
|
5007 | 5015 | |
|
5008 | 5016 | del self.__projectObjDict[key] |
|
5009 | 5017 | del self.__itemTreeDict[key] |
|
5010 | 5018 | |
|
5011 | 5019 | else: |
|
5012 | 5020 | puObj = self.__puObjDict[key] |
|
5013 | 5021 | idProjectParent = puObj.parentId |
|
5014 | 5022 | projectObj = self.__projectObjDict[idProjectParent] |
|
5015 | 5023 | |
|
5016 | 5024 | del self.__puObjDict[key] |
|
5017 | 5025 | del self.__itemTreeDict[key] |
|
5018 | 5026 | del projectObj.procUnitConfObjDict[key] |
|
5019 | 5027 | |
|
5020 | 5028 | for key in projectObj.procUnitConfObjDict.keys(): |
|
5021 | 5029 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): |
|
5022 | 5030 | continue |
|
5023 | 5031 | del self.__puObjDict[projectObj.procUnitConfObjDict[key].getId()] |
|
5024 | 5032 | del self.__itemTreeDict[projectObj.procUnitConfObjDict[key].getId()] |
|
5025 | 5033 | del projectObj.procUnitConfObjDict[key] |
|
5026 | 5034 | # print projectObj.procUnitConfObjDict |
|
5027 | 5035 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict |
|
5028 | 5036 | |
|
5029 | 5037 | def setInputsProject_View(self): |
|
5030 | 5038 | |
|
5031 | 5039 | self.tabWidgetProject.setEnabled(True) |
|
5032 | 5040 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
5033 | 5041 | self.tabProject.setEnabled(True) |
|
5034 | 5042 | self.frame_2.setEnabled(False) |
|
5035 | 5043 | self.proName.clear() |
|
5036 | 5044 | self.proName.setFocus() |
|
5037 | 5045 | self.proName.setSelection(0, 0) |
|
5038 | 5046 | self.proName.setCursorPosition(0) |
|
5039 | 5047 | self.proDataType.setText('.r') |
|
5040 | 5048 | self.proDataPath.clear() |
|
5041 | 5049 | self.proComDataType.clear() |
|
5042 | 5050 | self.proComDataType.addItem("Voltage") |
|
5043 | 5051 | self.proComDataType.addItem("Spectra") |
|
5044 | 5052 | self.proComDataType.addItem("Fits") |
|
5045 | 5053 | self.proComDataType.addItem("USRP") |
|
5046 | 5054 | |
|
5047 | 5055 | self.proComStartDate.clear() |
|
5048 | 5056 | self.proComEndDate.clear() |
|
5049 | 5057 | |
|
5050 | 5058 | startTime = "00:00:00" |
|
5051 | 5059 | endTime = "23:59:59" |
|
5052 | 5060 | starlist = startTime.split(":") |
|
5053 | 5061 | endlist = endTime.split(":") |
|
5054 | 5062 | self.proDelay.setText("60") |
|
5055 | 5063 | self.proSet.setText("") |
|
5056 | 5064 | |
|
5057 | 5065 | self.labelSet.show() |
|
5058 | 5066 | self.proSet.show() |
|
5059 | 5067 | |
|
5060 | 5068 | self.labelIPPKm.hide() |
|
5061 | 5069 | self.proIPPKm.hide() |
|
5062 | 5070 | |
|
5063 | 5071 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
5064 | 5072 | self.proStartTime.setTime(self.time) |
|
5065 | 5073 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
5066 | 5074 | self.proEndTime.setTime(self.time) |
|
5067 | 5075 | self.proDescription.clear() |
|
5068 | 5076 | self.proOk.setEnabled(False) |
|
5069 | 5077 | # self.console.append("Please, Write a name Project") |
|
5070 | 5078 | # self.console.append("Introduce Project Parameters")DC |
|
5071 | 5079 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") |
|
5072 | 5080 | |
|
5073 | 5081 | def clearPUWindow(self, datatype): |
|
5074 | 5082 | |
|
5075 | 5083 | projectObjView = self.getSelectedProjectObj() |
|
5076 | 5084 | |
|
5077 | 5085 | if not projectObjView: |
|
5078 | 5086 | return |
|
5079 | 5087 | |
|
5080 | 5088 | puObj = self.getSelectedItemObj() |
|
5081 | 5089 | inputId = puObj.getInputId() |
|
5082 | 5090 | inputPUObj = projectObjView.getProcUnitObj(inputId) |
|
5083 | 5091 | |
|
5084 | 5092 | if datatype == 'Voltage': |
|
5085 | 5093 | self.volOpComChannels.setEnabled(False) |
|
5086 | 5094 | self.volOpComHeights.setEnabled(False) |
|
5087 | 5095 | self.volOpFilter.setEnabled(False) |
|
5088 | 5096 | self.volOpComProfile.setEnabled(False) |
|
5089 | 5097 | self.volOpComCode.setEnabled(False) |
|
5090 | 5098 | self.volOpCohInt.setEnabled(False) |
|
5091 | 5099 | self.volOpChannel.setEnabled(False) |
|
5092 | 5100 | self.volOpHeights.setEnabled(False) |
|
5093 | 5101 | self.volOpProfile.setEnabled(False) |
|
5094 | 5102 | self.volOpRadarfrequency.setEnabled(False) |
|
5095 | 5103 | self.volOpCebChannels.setCheckState(0) |
|
5096 | 5104 | self.volOpCebRadarfrequency.setCheckState(0) |
|
5097 | 5105 | self.volOpCebHeights.setCheckState(0) |
|
5098 | 5106 | self.volOpCebFilter.setCheckState(0) |
|
5099 | 5107 | self.volOpCebProfile.setCheckState(0) |
|
5100 | 5108 | self.volOpCebDecodification.setCheckState(0) |
|
5101 | 5109 | self.volOpCebCohInt.setCheckState(0) |
|
5102 | 5110 | |
|
5103 | 5111 | self.volOpChannel.clear() |
|
5104 | 5112 | self.volOpHeights.clear() |
|
5105 | 5113 | self.volOpProfile.clear() |
|
5106 | 5114 | self.volOpFilter.clear() |
|
5107 | 5115 | self.volOpCohInt.clear() |
|
5108 | 5116 | self.volOpRadarfrequency.clear() |
|
5109 | 5117 | |
|
5110 | 5118 | if datatype == 'Spectra': |
|
5111 | 5119 | |
|
5112 | 5120 | if inputPUObj.datatype == 'Spectra': |
|
5113 | 5121 | self.specOpnFFTpoints.setEnabled(False) |
|
5114 | 5122 | self.specOpProfiles.setEnabled(False) |
|
5115 | 5123 | self.specOpippFactor.setEnabled(False) |
|
5116 | 5124 | else: |
|
5117 | 5125 | self.specOpnFFTpoints.setEnabled(True) |
|
5118 | 5126 | self.specOpProfiles.setEnabled(True) |
|
5119 | 5127 | self.specOpippFactor.setEnabled(True) |
|
5120 | 5128 | |
|
5121 | 5129 | self.specOpCebCrossSpectra.setCheckState(0) |
|
5122 | 5130 | self.specOpCebChannel.setCheckState(0) |
|
5123 | 5131 | self.specOpCebHeights.setCheckState(0) |
|
5124 | 5132 | self.specOpCebIncoherent.setCheckState(0) |
|
5125 | 5133 | self.specOpCebRemoveDC.setCheckState(0) |
|
5126 | 5134 | self.specOpCebRemoveInt.setCheckState(0) |
|
5127 | 5135 | self.specOpCebgetNoise.setCheckState(0) |
|
5128 | 5136 | self.specOpCebRadarfrequency.setCheckState(0) |
|
5129 | 5137 | |
|
5130 | 5138 | self.specOpRadarfrequency.setEnabled(False) |
|
5131 | 5139 | self.specOppairsList.setEnabled(False) |
|
5132 | 5140 | self.specOpChannel.setEnabled(False) |
|
5133 | 5141 | self.specOpHeights.setEnabled(False) |
|
5134 | 5142 | self.specOpIncoherent.setEnabled(False) |
|
5135 | 5143 | self.specOpgetNoise.setEnabled(False) |
|
5136 | 5144 | |
|
5137 | 5145 | self.specOpRadarfrequency.clear() |
|
5138 | 5146 | self.specOpnFFTpoints.clear() |
|
5139 | 5147 | self.specOpProfiles.clear() |
|
5140 | 5148 | self.specOpippFactor.clear |
|
5141 | 5149 | self.specOppairsList.clear() |
|
5142 | 5150 | self.specOpChannel.clear() |
|
5143 | 5151 | self.specOpHeights.clear() |
|
5144 | 5152 | self.specOpIncoherent.clear() |
|
5145 | 5153 | self.specOpgetNoise.clear() |
|
5146 | 5154 | |
|
5147 | 5155 | self.specGraphCebSpectraplot.setCheckState(0) |
|
5148 | 5156 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
5149 | 5157 | self.specGraphCebRTIplot.setCheckState(0) |
|
5150 | 5158 | self.specGraphCebRTInoise.setCheckState(0) |
|
5151 | 5159 | self.specGraphCebCoherencmap.setCheckState(0) |
|
5152 | 5160 | self.specGraphPowerprofile.setCheckState(0) |
|
5153 | 5161 | |
|
5154 | 5162 | self.specGraphSaveSpectra.setCheckState(0) |
|
5155 | 5163 | self.specGraphSaveCross.setCheckState(0) |
|
5156 | 5164 | self.specGraphSaveRTIplot.setCheckState(0) |
|
5157 | 5165 | self.specGraphSaveRTInoise.setCheckState(0) |
|
5158 | 5166 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
5159 | 5167 | self.specGraphSavePowerprofile.setCheckState(0) |
|
5160 | 5168 | |
|
5161 | 5169 | self.specGraphftpRTIplot.setCheckState(0) |
|
5162 | 5170 | self.specGraphftpRTInoise.setCheckState(0) |
|
5163 | 5171 | self.specGraphftpCoherencemap.setCheckState(0) |
|
5164 | 5172 | |
|
5165 | 5173 | self.specGraphPath.clear() |
|
5166 | 5174 | self.specGraphPrefix.clear() |
|
5167 | 5175 | |
|
5168 | 5176 | self.specGgraphftpratio.clear() |
|
5169 | 5177 | |
|
5170 | 5178 | self.specGgraphChannelList.clear() |
|
5171 | 5179 | self.specGgraphFreq.clear() |
|
5172 | 5180 | self.specGgraphHeight.clear() |
|
5173 | 5181 | self.specGgraphDbsrange.clear() |
|
5174 | 5182 | self.specGgraphmagnitud.clear() |
|
5175 | 5183 | self.specGgraphTminTmax.clear() |
|
5176 | 5184 | self.specGgraphTimeRange.clear() |
|
5177 | 5185 | |
|
5178 | 5186 | if datatype == 'SpectraHeis': |
|
5179 | 5187 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
5180 | 5188 | self.specHeisOpIncoherent.setEnabled(False) |
|
5181 | 5189 | self.specHeisOpIncoherent.clear() |
|
5182 | 5190 | |
|
5183 | 5191 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
5184 | 5192 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
5185 | 5193 | |
|
5186 | 5194 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
5187 | 5195 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
5188 | 5196 | |
|
5189 | 5197 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
5190 | 5198 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
5191 | 5199 | |
|
5192 | 5200 | self.specHeisGraphPath.clear() |
|
5193 | 5201 | self.specHeisGraphPrefix.clear() |
|
5194 | 5202 | self.specHeisGgraphChannelList.clear() |
|
5195 | 5203 | self.specHeisGgraphXminXmax.clear() |
|
5196 | 5204 | self.specHeisGgraphYminYmax.clear() |
|
5197 | 5205 | self.specHeisGgraphTminTmax.clear() |
|
5198 | 5206 | self.specHeisGgraphTimeRange.clear() |
|
5199 | 5207 | self.specHeisGgraphftpratio.clear() |
|
5200 | 5208 | |
|
5201 | 5209 | def showtabPUCreated(self, datatype): |
|
5202 | 5210 | |
|
5203 | 5211 | if datatype == "Voltage": |
|
5204 | 5212 | self.tabVoltage.setEnabled(True) |
|
5205 | 5213 | self.tabProject.setEnabled(False) |
|
5206 | 5214 | self.tabSpectra.setEnabled(False) |
|
5207 | 5215 | self.tabCorrelation.setEnabled(False) |
|
5208 | 5216 | self.tabSpectraHeis.setEnabled(False) |
|
5209 | 5217 | self.tabWidgetProject.setCurrentWidget(self.tabVoltage) |
|
5210 | 5218 | |
|
5211 | 5219 | if datatype == "Spectra": |
|
5212 | 5220 | self.tabVoltage.setEnabled(False) |
|
5213 | 5221 | self.tabProject.setEnabled(False) |
|
5214 | 5222 | self.tabSpectra.setEnabled(True) |
|
5215 | 5223 | self.tabCorrelation.setEnabled(False) |
|
5216 | 5224 | self.tabSpectraHeis.setEnabled(False) |
|
5217 | 5225 | self.tabWidgetProject.setCurrentWidget(self.tabSpectra) |
|
5218 | 5226 | |
|
5219 | 5227 | if datatype == "SpectraHeis": |
|
5220 | 5228 | self.tabVoltage.setEnabled(False) |
|
5221 | 5229 | self.tabProject.setEnabled(False) |
|
5222 | 5230 | self.tabSpectra.setEnabled(False) |
|
5223 | 5231 | self.tabCorrelation.setEnabled(False) |
|
5224 | 5232 | self.tabSpectraHeis.setEnabled(True) |
|
5225 | 5233 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) |
|
5226 | 5234 | |
|
5227 | 5235 | def checkInputsProject(self): |
|
5228 | 5236 | """ |
|
5229 | 5237 | Check Inputs Project: |
|
5230 | 5238 | - project_name |
|
5231 | 5239 | - datatype |
|
5232 | 5240 | - ext |
|
5233 | 5241 | - data_path |
|
5234 | 5242 | - readmode |
|
5235 | 5243 | - delay |
|
5236 | 5244 | - set |
|
5237 | 5245 | - walk |
|
5238 | 5246 | """ |
|
5239 | 5247 | parms_ok = True |
|
5240 | 5248 | project_name = str(self.proName.text()) |
|
5241 | 5249 | if project_name == '' or project_name == None: |
|
5242 | 5250 | outputstr = "Enter the Project Name" |
|
5243 | 5251 | self.console.append(outputstr) |
|
5244 | 5252 | parms_ok = False |
|
5245 | 5253 | project_name = None |
|
5246 | 5254 | |
|
5247 | 5255 | datatype = str(self.proComDataType.currentText()) |
|
5248 | 5256 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): |
|
5249 | 5257 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype |
|
5250 | 5258 | self.console.append(outputstr) |
|
5251 | 5259 | parms_ok = False |
|
5252 | 5260 | datatype = None |
|
5253 | 5261 | |
|
5254 | 5262 | ext = str(self.proDataType.text()) |
|
5255 | 5263 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): |
|
5256 | 5264 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" |
|
5257 | 5265 | self.console.append(outputstr) |
|
5258 | 5266 | parms_ok = False |
|
5259 | 5267 | ext = None |
|
5260 | 5268 | |
|
5261 | 5269 | data_path = str(self.proDataPath.text()) |
|
5262 | 5270 | |
|
5263 | 5271 | if data_path == '': |
|
5264 | 5272 | outputstr = 'Datapath is empty' |
|
5265 | 5273 | self.console.append(outputstr) |
|
5266 | 5274 | parms_ok = False |
|
5267 | 5275 | data_path = None |
|
5268 | 5276 | |
|
5269 | 5277 | if data_path != None: |
|
5270 | 5278 | if not os.path.isdir(data_path): |
|
5271 | 5279 | outputstr = 'Datapath:%s does not exist' % data_path |
|
5272 | 5280 | self.console.append(outputstr) |
|
5273 | 5281 | parms_ok = False |
|
5274 | 5282 | data_path = None |
|
5275 | 5283 | |
|
5276 | 5284 | read_mode = str(self.proComReadMode.currentText()) |
|
5277 | 5285 | if not(read_mode in ['Online', 'Offline']): |
|
5278 | 5286 | outputstr = 'Read Mode: %s, this must be either Online or Offline' % read_mode |
|
5279 | 5287 | self.console.append(outputstr) |
|
5280 | 5288 | parms_ok = False |
|
5281 | 5289 | read_mode = None |
|
5282 | 5290 | |
|
5283 | 5291 | delay = None |
|
5284 | 5292 | if read_mode == "Online": |
|
5285 | 5293 | parms_ok = False |
|
5286 | 5294 | try: |
|
5287 | 5295 | delay = int(str(self.proDelay.text())) |
|
5288 | 5296 | parms_ok = True |
|
5289 | 5297 | except: |
|
5290 | 5298 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) |
|
5291 | 5299 | self.console.append(outputstr) |
|
5292 | 5300 | |
|
5293 | 5301 | try: |
|
5294 | 5302 | set = int(str(self.proSet.text())) |
|
5295 | 5303 | except: |
|
5296 | 5304 | # outputstr = 'Set: %s, this must be a integer number' % str(self.proName.text()) |
|
5297 | 5305 | # self.console.append(outputstr) |
|
5298 | 5306 | # parms_ok = False |
|
5299 | 5307 | set = None |
|
5300 | 5308 | |
|
5301 | 5309 | walk = int(self.proComWalk.currentIndex()) |
|
5302 | 5310 | expLabel = str(self.proExpLabel.text()) |
|
5303 | 5311 | |
|
5304 | 5312 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel |
|
5305 | 5313 | |
|
5306 | 5314 | def checkInputsPUSave(self, datatype): |
|
5307 | 5315 | """ |
|
5308 | 5316 | Check Inputs Spectra Save: |
|
5309 | 5317 | - path |
|
5310 | 5318 | - blocks Per File |
|
5311 | 5319 | - sufix |
|
5312 | 5320 | - dataformat |
|
5313 | 5321 | """ |
|
5314 | 5322 | parms_ok = True |
|
5315 | 5323 | |
|
5316 | 5324 | if datatype == "Voltage": |
|
5317 | 5325 | output_path = str(self.volOutputPath.text()) |
|
5318 | 5326 | blocksperfile = str(self.volOutputblocksperfile.text()) |
|
5319 | 5327 | profilesperblock = str(self.volOutputprofilesperblock.text()) |
|
5320 | 5328 | |
|
5321 | 5329 | if datatype == "Spectra": |
|
5322 | 5330 | output_path = str(self.specOutputPath.text()) |
|
5323 | 5331 | blocksperfile = str(self.specOutputblocksperfile.text()) |
|
5324 | 5332 | profilesperblock = 0 |
|
5325 | 5333 | |
|
5326 | 5334 | if datatype == "SpectraHeis": |
|
5327 | 5335 | output_path = str(self.specHeisOutputPath.text()) |
|
5328 | 5336 | blocksperfile = str(self.specHeisOutputblocksperfile.text()) |
|
5329 | 5337 | metadata_file = str(self.specHeisOutputMetada.text()) |
|
5330 | 5338 | |
|
5331 | 5339 | message = '' |
|
5332 | 5340 | |
|
5333 | 5341 | if not os.path.isdir(output_path): |
|
5334 | 5342 | message += 'OutputPath:%s does not exist\n' % output_path |
|
5335 | 5343 | parms_ok = False |
|
5336 | 5344 | |
|
5337 | 5345 | try: |
|
5338 | 5346 | profilesperblock = int(profilesperblock) |
|
5339 | 5347 | except: |
|
5340 | 5348 | if datatype == "Voltage": |
|
5341 | 5349 | message += 'Profilesperblock: %s, this must be a integer number\n' % str(self.volOutputprofilesperblock.text()) |
|
5342 | 5350 | parms_ok = False |
|
5343 | 5351 | profilesperblock = None |
|
5344 | 5352 | |
|
5345 | 5353 | try: |
|
5346 | 5354 | blocksperfile = int(blocksperfile) |
|
5347 | 5355 | except: |
|
5348 | 5356 | if datatype == "Voltage": |
|
5349 | 5357 | message += 'Blocksperfile: %s, this must be a integer number\n' % str(self.volOutputblocksperfile.text()) |
|
5350 | 5358 | elif datatype == "Spectra": |
|
5351 | 5359 | message += 'Blocksperfile: %s, this must be a integer number\n' % str(self.specOutputblocksperfile.text()) |
|
5352 | 5360 | elif datatype == "SpectraHeis": |
|
5353 | 5361 | message += 'Blocksperfile: %s, this must be a integer number\n' % str(self.specHeisOutputblocksperfile.text()) |
|
5354 | 5362 | |
|
5355 | 5363 | parms_ok = False |
|
5356 | 5364 | blocksperfile = None |
|
5357 | 5365 | |
|
5358 | 5366 | if datatype == "SpectraHeis": |
|
5359 | 5367 | if metadata_file != '': |
|
5360 | 5368 | if not os.path.isfile(metadata_file): |
|
5361 | 5369 | message += 'Metadata file %s does not exist\n' % metadata_file |
|
5362 | 5370 | parms_ok = False |
|
5363 | 5371 | |
|
5364 | 5372 | if str.strip(output_path) != '': |
|
5365 | 5373 | self.console.append(message) |
|
5366 | 5374 | |
|
5367 | 5375 | if datatype == "Voltage": |
|
5368 | 5376 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5369 | 5377 | |
|
5370 | 5378 | |
|
5371 | 5379 | if datatype == "Spectra": |
|
5372 | 5380 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5373 | 5381 | |
|
5374 | 5382 | |
|
5375 | 5383 | if datatype == "SpectraHeis": |
|
5376 | 5384 | return parms_ok, output_path, blocksperfile, metadata_file |
|
5377 | 5385 | |
|
5378 | 5386 | def findDatafiles(self, data_path, ext, walk, expLabel=''): |
|
5379 | 5387 | |
|
5380 | 5388 | dateList = [] |
|
5381 | 5389 | fileList = [] |
|
5382 | 5390 | |
|
5383 | 5391 | if ext == ".r": |
|
5384 | 5392 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5385 | 5393 | |
|
5386 | 5394 | readerObj = JRODataReader() |
|
5387 | 5395 | dateList = readerObj.findDatafiles(path=data_path, |
|
5388 | 5396 | expLabel=expLabel, |
|
5389 | 5397 | ext=ext, |
|
5390 | 5398 | walk=walk) |
|
5391 | 5399 | |
|
5392 | 5400 | if ext == ".pdata": |
|
5393 | 5401 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5394 | 5402 | |
|
5395 | 5403 | readerObj = JRODataReader() |
|
5396 | 5404 | dateList = readerObj.findDatafiles(path=data_path, |
|
5397 | 5405 | expLabel=expLabel, |
|
5398 | 5406 | ext=ext, |
|
5399 | 5407 | walk=walk) |
|
5400 | 5408 | |
|
5401 | 5409 | if ext == ".fits": |
|
5402 | 5410 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5403 | 5411 | |
|
5404 | 5412 | readerObj = JRODataReader() |
|
5405 | 5413 | dateList = readerObj.findDatafiles(path=data_path, |
|
5406 | 5414 | expLabel=expLabel, |
|
5407 | 5415 | ext=ext, |
|
5408 | 5416 | walk=walk) |
|
5409 | 5417 | |
|
5410 | 5418 | if ext == ".hdf5": |
|
5411 | 5419 | from schainpy.model.io.jroIO_usrp import USRPReader |
|
5412 | 5420 | |
|
5413 | 5421 | readerObj = USRPReader() |
|
5414 | 5422 | dateList = readerObj.findDatafiles(path=data_path) |
|
5415 | 5423 | |
|
5416 | 5424 | return dateList |
|
5417 | 5425 | |
|
5418 | 5426 | def loadDays(self, data_path, ext, walk, expLabel=''): |
|
5419 | 5427 | """ |
|
5420 | 5428 | Method to loads day |
|
5421 | 5429 | """ |
|
5422 | 5430 | # self._disable_save_button() |
|
5423 | 5431 | # self._disable_play_button() |
|
5424 | 5432 | # self.proOk.setEnabled(False) |
|
5425 | 5433 | |
|
5426 | 5434 | self.proComStartDate.clear() |
|
5427 | 5435 | self.proComEndDate.clear() |
|
5428 | 5436 | |
|
5429 | 5437 | self.dateList = [] |
|
5430 | 5438 | |
|
5431 | 5439 | if not data_path: |
|
5432 | 5440 | self.console.append("Datapath has not been set") |
|
5433 | 5441 | return [] |
|
5434 | 5442 | |
|
5435 | 5443 | if not os.path.isdir(data_path): |
|
5436 | 5444 | self.console.append("Directory %s does not exist" %data_path) |
|
5437 | 5445 | return [] |
|
5438 | 5446 | |
|
5439 | 5447 | self.dataPath = data_path |
|
5440 | 5448 | |
|
5441 | 5449 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) |
|
5442 | 5450 | |
|
5443 | 5451 | if not dateList: |
|
5444 | 5452 | # self.console.clear() |
|
5445 | 5453 | if walk: |
|
5446 | 5454 | if expLabel: |
|
5447 | 5455 | outputstr = "No files (*%s) were found on %s/DOYPATH/%s" % (ext, data_path, expLabel) |
|
5448 | 5456 | else: |
|
5449 | 5457 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) |
|
5450 | 5458 | else: |
|
5451 | 5459 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) |
|
5452 | 5460 | |
|
5453 | 5461 | self.console.append(outputstr) |
|
5454 | 5462 | return [] |
|
5455 | 5463 | |
|
5456 | 5464 | dateStrList = [] |
|
5457 | 5465 | for thisDate in dateList: |
|
5458 | 5466 | dateStr = thisDate.strftime("%Y/%m/%d") |
|
5459 | 5467 | |
|
5460 | 5468 | self.proComStartDate.addItem(dateStr) |
|
5461 | 5469 | self.proComEndDate.addItem(dateStr) |
|
5462 | 5470 | dateStrList.append(dateStr) |
|
5463 | 5471 | |
|
5464 | 5472 | self.proComStartDate.setCurrentIndex(0) |
|
5465 | 5473 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
5466 | 5474 | |
|
5467 | 5475 | self.dateList = dateStrList |
|
5468 | 5476 | |
|
5469 | 5477 | self.console.clear() |
|
5470 | 5478 | self.console.append("Successful load") |
|
5471 | 5479 | |
|
5472 | 5480 | # self.proOk.setEnabled(True) |
|
5473 | 5481 | # self._enable_play_button() |
|
5474 | 5482 | # self._enable_save_button() |
|
5475 | 5483 | |
|
5476 | 5484 | return self.dateList |
|
5477 | 5485 | |
|
5478 | 5486 | def setWorkSpaceGUI(self, pathWorkSpace=None): |
|
5479 | 5487 | |
|
5480 | 5488 | if pathWorkSpace == None: |
|
5481 | 5489 | home = os.path.expanduser("~") |
|
5482 | 5490 | pathWorkSpace = os.path.join(home,'schain_workspace') |
|
5483 | 5491 | |
|
5484 | 5492 | self.pathWorkSpace = pathWorkSpace |
|
5485 | 5493 | |
|
5486 | 5494 | """ |
|
5487 | 5495 | Comandos Usados en Console |
|
5488 | 5496 | """ |
|
5489 | 5497 | def __del__(self): |
|
5490 | 5498 | sys.stdout = sys.__stdout__ |
|
5491 | 5499 | sys.stderr = sys.__stderr__ |
|
5492 | 5500 | |
|
5493 | 5501 | def normalOutputWritten(self, text): |
|
5494 | 5502 | color_black = QtGui.QColor(0,0,0) |
|
5495 | 5503 | self.console.setTextColor(color_black) |
|
5496 | 5504 | self.console.append(text) |
|
5497 | 5505 | |
|
5498 | 5506 | def errorOutputWritten(self, text): |
|
5499 | 5507 | color_red = QtGui.QColor(255,0,0) |
|
5500 | 5508 | color_black = QtGui.QColor(0,0,0) |
|
5501 | 5509 | |
|
5502 | 5510 | self.console.setTextColor(color_red) |
|
5503 | 5511 | self.console.append(text) |
|
5504 | 5512 | self.console.setTextColor(color_black) |
|
5505 | 5513 | |
|
5506 | 5514 | def _enable_save_button(self): |
|
5507 | 5515 | |
|
5508 | 5516 | self.actionSaveToolbar.setEnabled(True) |
|
5509 | 5517 | self.actionSave.setEnabled(True) |
|
5510 | 5518 | |
|
5511 | 5519 | def _disable_save_button(self): |
|
5512 | 5520 | |
|
5513 | 5521 | self.actionSaveToolbar.setEnabled(False) |
|
5514 | 5522 | self.actionSave.setEnabled(False) |
|
5515 | 5523 | |
|
5516 | 5524 | def _enable_play_button(self): |
|
5517 | 5525 | |
|
5518 | 5526 | if self.controllerThread: |
|
5519 | 5527 | if self.controllerThread.isRunning(): |
|
5520 | 5528 | return |
|
5521 | 5529 | |
|
5522 | 5530 | self.actionStart.setEnabled(True) |
|
5523 | 5531 | self.actionStarToolbar.setEnabled(True) |
|
5524 | 5532 | |
|
5525 | 5533 | self.changeStartIcon(started=False) |
|
5526 | 5534 | |
|
5527 | 5535 | def _disable_play_button(self): |
|
5528 | 5536 | |
|
5529 | 5537 | self.actionStart.setEnabled(False) |
|
5530 | 5538 | self.actionStarToolbar.setEnabled(False) |
|
5531 | 5539 | |
|
5532 | 5540 | self.changeStartIcon(started=True) |
|
5533 | 5541 | |
|
5534 | 5542 | def _enable_stop_button(self): |
|
5535 | 5543 | |
|
5536 | 5544 | self.actionPause.setEnabled(True) |
|
5537 | 5545 | self.actionStop.setEnabled(True) |
|
5538 | 5546 | |
|
5539 | 5547 | self.actionPauseToolbar.setEnabled(True) |
|
5540 | 5548 | self.actionStopToolbar.setEnabled(True) |
|
5541 | 5549 | |
|
5542 | 5550 | self.changePauseIcon(paused=False) |
|
5543 | 5551 | self.changeStopIcon(started=True) |
|
5544 | 5552 | |
|
5545 | 5553 | def _disable_stop_button(self): |
|
5546 | 5554 | |
|
5547 | 5555 | self.actionPause.setEnabled(False) |
|
5548 | 5556 | self.actionStop.setEnabled(False) |
|
5549 | 5557 | |
|
5550 | 5558 | self.actionPauseToolbar.setEnabled(False) |
|
5551 | 5559 | self.actionStopToolbar.setEnabled(False) |
|
5552 | 5560 | |
|
5553 | 5561 | self.changePauseIcon(paused=False) |
|
5554 | 5562 | self.changeStopIcon(started=False) |
|
5555 | 5563 | |
|
5556 | 5564 | def setGUIStatus(self): |
|
5557 | 5565 | |
|
5558 | 5566 | self.setWindowTitle("ROJ-Signal Chain") |
|
5559 | 5567 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"logo.png") )) |
|
5560 | 5568 | |
|
5561 | 5569 | self.tabWidgetProject.setEnabled(False) |
|
5562 | 5570 | self.tabVoltage.setEnabled(False) |
|
5563 | 5571 | self.tabSpectra.setEnabled(False) |
|
5564 | 5572 | self.tabCorrelation.setEnabled(False) |
|
5565 | 5573 | self.frame_2.setEnabled(False) |
|
5566 | 5574 | |
|
5567 | 5575 | self.actionCreate.setShortcut('Ctrl+N') |
|
5568 | 5576 | self.actionOpen.setShortcut('Ctrl+O') |
|
5569 | 5577 | self.actionSave.setShortcut('Ctrl+S') |
|
5570 | 5578 | self.actionClose.setShortcut('Ctrl+X') |
|
5571 | 5579 | |
|
5572 | 5580 | self.actionStart.setShortcut('Ctrl+1') |
|
5573 | 5581 | self.actionPause.setShortcut('Ctrl+2') |
|
5574 | 5582 | self.actionStop.setShortcut('Ctrl+3') |
|
5575 | 5583 | |
|
5576 | 5584 | self.actionFTP.setShortcut('Ctrl+F') |
|
5577 | 5585 | |
|
5578 | 5586 | self.actionStart.setEnabled(False) |
|
5579 | 5587 | self.actionPause.setEnabled(False) |
|
5580 | 5588 | self.actionStop.setEnabled(False) |
|
5581 | 5589 | |
|
5582 | 5590 | self.actionStarToolbar.setEnabled(False) |
|
5583 | 5591 | self.actionPauseToolbar.setEnabled(False) |
|
5584 | 5592 | self.actionStopToolbar.setEnabled(False) |
|
5585 | 5593 | |
|
5586 | 5594 | self.proName.clear() |
|
5587 | 5595 | self.proDataPath.setText('') |
|
5588 | 5596 | self.console.setReadOnly(True) |
|
5589 | 5597 | self.console.append("Welcome to Signal Chain\n\n") |
|
5590 | 5598 | self.console.append("Open a project or Create a new one\n") |
|
5591 | 5599 | self.proStartTime.setDisplayFormat("hh:mm:ss") |
|
5592 | 5600 | self.proDataType.setEnabled(False) |
|
5593 | 5601 | self.time = QtCore.QTime() |
|
5594 | 5602 | self.proEndTime.setDisplayFormat("hh:mm:ss") |
|
5595 | 5603 | startTime = "00:00:00" |
|
5596 | 5604 | endTime = "23:59:59" |
|
5597 | 5605 | starlist = startTime.split(":") |
|
5598 | 5606 | endlist = endTime.split(":") |
|
5599 | 5607 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
5600 | 5608 | self.proStartTime.setTime(self.time) |
|
5601 | 5609 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
5602 | 5610 | self.proEndTime.setTime(self.time) |
|
5603 | 5611 | self.proOk.setEnabled(False) |
|
5604 | 5612 | # set model Project Explorer |
|
5605 | 5613 | self.projectExplorerModel = QtGui.QStandardItemModel() |
|
5606 | 5614 | self.projectExplorerModel.setHorizontalHeaderLabels(("Project Explorer",)) |
|
5607 | 5615 | layout = QtGui.QVBoxLayout() |
|
5608 | 5616 | layout.addWidget(self.projectExplorerTree) |
|
5609 | 5617 | self.projectExplorerTree.setModel(self.projectExplorerModel) |
|
5610 | 5618 | self.projectExplorerTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) |
|
5611 | 5619 | self.projectExplorerTree.customContextMenuRequested.connect(self.on_right_click) |
|
5612 | 5620 | self.projectExplorerTree.clicked.connect(self.on_click) |
|
5613 | 5621 | self.projectExplorerTree.expandAll() |
|
5614 | 5622 | # set model Project Properties |
|
5615 | 5623 | |
|
5616 | 5624 | self.propertiesModel = TreeModel() |
|
5617 | 5625 | self.propertiesModel.initProjectView() |
|
5618 | 5626 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
5619 | 5627 | self.treeProjectProperties.expandAll() |
|
5620 | 5628 | self.treeProjectProperties.allColumnsShowFocus() |
|
5621 | 5629 | self.treeProjectProperties.resizeColumnToContents(1) |
|
5622 | 5630 | |
|
5623 | 5631 | # set Project |
|
5624 | 5632 | self.pronTxs.setEnabled(False) |
|
5625 | 5633 | self.proComByBlock.setEnabled(False) |
|
5626 | 5634 | self.proExpLabel.setEnabled(False) |
|
5627 | 5635 | self.proDelay.setEnabled(False) |
|
5628 | 5636 | self.proSet.setEnabled(True) |
|
5629 | 5637 | self.proDataType.setReadOnly(True) |
|
5630 | 5638 | |
|
5631 | 5639 | # set Operation Voltage |
|
5632 | 5640 | self.volOpComChannels.setEnabled(False) |
|
5633 | 5641 | self.volOpComHeights.setEnabled(False) |
|
5634 | 5642 | self.volOpFilter.setEnabled(False) |
|
5635 | 5643 | self.volOpComProfile.setEnabled(False) |
|
5636 | 5644 | self.volOpComCode.setEnabled(False) |
|
5637 | 5645 | self.volOpFlip.setEnabled(False) |
|
5638 | 5646 | self.volOpCohInt.setEnabled(False) |
|
5639 | 5647 | self.volOpRadarfrequency.setEnabled(False) |
|
5640 | 5648 | |
|
5641 | 5649 | self.volOpChannel.setEnabled(False) |
|
5642 | 5650 | self.volOpHeights.setEnabled(False) |
|
5643 | 5651 | self.volOpProfile.setEnabled(False) |
|
5644 | 5652 | self.volOpComMode.setEnabled(False) |
|
5645 | 5653 | |
|
5646 | 5654 | self.volOpReshaper.setEnabled(False) |
|
5647 | 5655 | self.volOpAdjustHei.setEnabled(False) |
|
5648 | 5656 | |
|
5649 | 5657 | self.volOpCebReshaper.setEnabled(False) |
|
5650 | 5658 | self.volOpCebAdjustHei.setEnabled(False) |
|
5651 | 5659 | |
|
5652 | 5660 | self.volGraphPath.setEnabled(False) |
|
5653 | 5661 | self.volGraphPrefix.setEnabled(False) |
|
5654 | 5662 | self.volGraphToolPath.setEnabled(False) |
|
5655 | 5663 | |
|
5656 | 5664 | # set Graph Voltage |
|
5657 | 5665 | self.volGraphChannelList.setEnabled(False) |
|
5658 | 5666 | self.volGraphIntensityRange.setEnabled(False) |
|
5659 | 5667 | self.volGraphHeightrange.setEnabled(False) |
|
5660 | 5668 | |
|
5661 | 5669 | # set Operation Spectra |
|
5662 | 5670 | self.specOpnFFTpoints.setEnabled(False) |
|
5663 | 5671 | self.specOpProfiles.setEnabled(False) |
|
5664 | 5672 | self.specOpippFactor.setEnabled(False) |
|
5665 | 5673 | self.specOppairsList.setEnabled(False) |
|
5666 | 5674 | |
|
5667 | 5675 | self.specOpComCrossSpectra.setEnabled(False) |
|
5668 | 5676 | self.specOpComChannel.setEnabled(False) |
|
5669 | 5677 | self.specOpComHeights.setEnabled(False) |
|
5670 | 5678 | self.specOpIncoherent.setEnabled(False) |
|
5671 | 5679 | self.specOpgetNoise.setEnabled(False) |
|
5672 | 5680 | self.specOpRadarfrequency.setEnabled(False) |
|
5673 | 5681 | |
|
5674 | 5682 | |
|
5675 | 5683 | self.specOpChannel.setEnabled(False) |
|
5676 | 5684 | self.specOpHeights.setEnabled(False) |
|
5677 | 5685 | # set Graph Spectra |
|
5678 | 5686 | self.specGgraphChannelList.setEnabled(False) |
|
5679 | 5687 | self.specGgraphFreq.setEnabled(False) |
|
5680 | 5688 | self.specGgraphHeight.setEnabled(False) |
|
5681 | 5689 | self.specGgraphDbsrange.setEnabled(False) |
|
5682 | 5690 | self.specGgraphmagnitud.setEnabled(False) |
|
5683 | 5691 | self.specGgraphTminTmax.setEnabled(False) |
|
5684 | 5692 | self.specGgraphTimeRange.setEnabled(False) |
|
5685 | 5693 | self.specGraphPath.setEnabled(False) |
|
5686 | 5694 | self.specGraphToolPath.setEnabled(False) |
|
5687 | 5695 | self.specGraphPrefix.setEnabled(False) |
|
5688 | 5696 | |
|
5689 | 5697 | self.specGgraphftpratio.setEnabled(False) |
|
5690 | 5698 | # set Operation SpectraHeis |
|
5691 | 5699 | self.specHeisOpIncoherent.setEnabled(False) |
|
5692 | 5700 | self.specHeisOpCobIncInt.setEnabled(False) |
|
5693 | 5701 | # set Graph SpectraHeis |
|
5694 | 5702 | self.specHeisGgraphChannelList.setEnabled(False) |
|
5695 | 5703 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
5696 | 5704 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
5697 | 5705 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
5698 | 5706 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
5699 | 5707 | self.specHeisGgraphftpratio.setEnabled(False) |
|
5700 | 5708 | self.specHeisGraphPath.setEnabled(False) |
|
5701 | 5709 | self.specHeisGraphPrefix.setEnabled(False) |
|
5702 | 5710 | self.specHeisGraphToolPath.setEnabled(False) |
|
5703 | 5711 | |
|
5704 | 5712 | self.proComWalk.setCurrentIndex(0) |
|
5705 | 5713 | |
|
5706 | 5714 | # tool tip gui |
|
5707 | 5715 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) |
|
5708 | 5716 | self.projectExplorerTree.setToolTip('Right clik to add Project or Unit Process') |
|
5709 | 5717 | # tool tip gui project |
|
5710 | 5718 | |
|
5711 | 5719 | # tool tip gui volOp |
|
5712 | 5720 | # self.volOpChannel.setToolTip('Example: 1,2,3,4,5') |
|
5713 | 5721 | # self.volOpHeights.setToolTip('Example: 90,180') |
|
5714 | 5722 | # self.volOpFilter.setToolTip('Example: 2') |
|
5715 | 5723 | # self.volOpProfile.setToolTip('Example:0,127') |
|
5716 | 5724 | # self.volOpCohInt.setToolTip('Example: 128') |
|
5717 | 5725 | # self.volOpFlip.setToolTip('ChannelList where flip will be applied. Example: 0,2,3') |
|
5718 | 5726 | # self.volOpOk.setToolTip('If you have finished, please Ok ') |
|
5719 | 5727 | # # tool tip gui volGraph |
|
5720 | 5728 | # self.volGraphIntensityRange.setToolTip('Height range. Example: 50,100') |
|
5721 | 5729 | # self.volGraphHeightrange.setToolTip('Amplitude. Example: 0,10000') |
|
5722 | 5730 | # tool tip gui specOp |
|
5723 | 5731 | # self.specOpnFFTpoints.setToolTip('Example: 128') |
|
5724 | 5732 | # self.specOpProfiles.setToolTip('Example: 128') |
|
5725 | 5733 | # self.specOpippFactor.setToolTip('Example:1.0') |
|
5726 | 5734 | # self.specOpIncoherent.setToolTip('Example: 10') |
|
5727 | 5735 | # self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') |
|
5728 | 5736 | # |
|
5729 | 5737 | # self.specOpChannel.setToolTip('Example: 0,1,2,3') |
|
5730 | 5738 | # self.specOpHeights.setToolTip('Example: 90,180') |
|
5731 | 5739 | # self.specOppairsList.setToolTip('Example: (0,1),(2,3)') |
|
5732 | 5740 | # # tool tip gui specGraph |
|
5733 | 5741 | # |
|
5734 | 5742 | # self.specGgraphChannelList.setToolTip('Example: 0,3,4') |
|
5735 | 5743 | # self.specGgraphFreq.setToolTip('Example: -20,20') |
|
5736 | 5744 | # self.specGgraphHeight.setToolTip('Example: 100,400') |
|
5737 | 5745 | # self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
5738 | 5746 | # |
|
5739 | 5747 | # self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
5740 | 5748 | # |
|
5741 | 5749 | # |
|
5742 | 5750 | # self.specHeisOpIncoherent.setToolTip('Example: 10') |
|
5743 | 5751 | # |
|
5744 | 5752 | # self.specHeisGgraphChannelList.setToolTip('Example: 0,2,3') |
|
5745 | 5753 | # self.specHeisGgraphXminXmax.setToolTip('Example (Hz): -1000, 1000') |
|
5746 | 5754 | # self.specHeisGgraphYminYmax.setToolTip('Example (dB): 5, 35') |
|
5747 | 5755 | # self.specHeisGgraphTminTmax.setToolTip('Example (hours): 0, 24') |
|
5748 | 5756 | # self.specHeisGgraphTimeRange.setToolTip('Example (hours): 8') |
|
5749 | 5757 | |
|
5750 | 5758 | self.labelSet.show() |
|
5751 | 5759 | self.proSet.show() |
|
5752 | 5760 | |
|
5753 | 5761 | self.labelIPPKm.hide() |
|
5754 | 5762 | self.proIPPKm.hide() |
|
5755 | 5763 | |
|
5756 | 5764 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
5757 | 5765 | # sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) |
|
5758 | 5766 | |
|
5759 | 5767 | |
|
5760 | 5768 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
|
5761 | 5769 | """ |
|
5762 | 5770 | Class documentation goes here. |
|
5763 | 5771 | """ |
|
5764 | 5772 | closed = pyqtSignal() |
|
5765 | 5773 | create = False |
|
5766 | 5774 | |
|
5767 | 5775 | def __init__(self, parent=None): |
|
5768 | 5776 | """ |
|
5769 | 5777 | Constructor |
|
5770 | 5778 | """ |
|
5771 | 5779 | QMainWindow.__init__(self, parent) |
|
5772 | 5780 | self.setupUi(self) |
|
5773 | 5781 | self.getFromWindow = None |
|
5774 | 5782 | self.getfromWindowList = [] |
|
5775 | 5783 | self.dataTypeProject = None |
|
5776 | 5784 | |
|
5777 | 5785 | self.listUP = None |
|
5778 | 5786 | |
|
5779 | 5787 | @pyqtSignature("") |
|
5780 | 5788 | def on_unitPokbut_clicked(self): |
|
5781 | 5789 | """ |
|
5782 | 5790 | Slot documentation goes here. |
|
5783 | 5791 | """ |
|
5784 | 5792 | self.create = True |
|
5785 | 5793 | self.getFromWindow = self.getfromWindowList[int(self.comboInputBox.currentIndex())] |
|
5786 | 5794 | # self.nameofUP= str(self.nameUptxt.text()) |
|
5787 | 5795 | self.typeofUP = str(self.comboTypeBox.currentText()) |
|
5788 | 5796 | self.close() |
|
5789 | 5797 | |
|
5790 | 5798 | |
|
5791 | 5799 | @pyqtSignature("") |
|
5792 | 5800 | def on_unitPcancelbut_clicked(self): |
|
5793 | 5801 | """ |
|
5794 | 5802 | Slot documentation goes here. |
|
5795 | 5803 | """ |
|
5796 | 5804 | self.create = False |
|
5797 | 5805 | self.close() |
|
5798 | 5806 | |
|
5799 | 5807 | def loadTotalList(self): |
|
5800 | 5808 | self.comboInputBox.clear() |
|
5801 | 5809 | for i in self.getfromWindowList: |
|
5802 | 5810 | |
|
5803 | 5811 | name = i.getElementName() |
|
5804 | 5812 | if name == 'Project': |
|
5805 | 5813 | id = i.id |
|
5806 | 5814 | name = i.name |
|
5807 | 5815 | if self.dataTypeProject == 'Voltage': |
|
5808 | 5816 | self.comboTypeBox.clear() |
|
5809 | 5817 | self.comboTypeBox.addItem("Voltage") |
|
5810 | 5818 | |
|
5811 | 5819 | if self.dataTypeProject == 'Spectra': |
|
5812 | 5820 | self.comboTypeBox.clear() |
|
5813 | 5821 | self.comboTypeBox.addItem("Spectra") |
|
5814 | 5822 | self.comboTypeBox.addItem("Correlation") |
|
5815 | 5823 | if self.dataTypeProject == 'Fits': |
|
5816 | 5824 | self.comboTypeBox.clear() |
|
5817 | 5825 | self.comboTypeBox.addItem("SpectraHeis") |
|
5818 | 5826 | |
|
5819 | 5827 | |
|
5820 | 5828 | if name == 'ProcUnit': |
|
5821 | 5829 | id = int(i.id) - 1 |
|
5822 | 5830 | name = i.datatype |
|
5823 | 5831 | if name == 'Voltage': |
|
5824 | 5832 | self.comboTypeBox.clear() |
|
5825 | 5833 | self.comboTypeBox.addItem("Spectra") |
|
5826 | 5834 | self.comboTypeBox.addItem("SpectraHeis") |
|
5827 | 5835 | self.comboTypeBox.addItem("Correlation") |
|
5828 | 5836 | if name == 'Spectra': |
|
5829 | 5837 | self.comboTypeBox.clear() |
|
5830 | 5838 | self.comboTypeBox.addItem("Spectra") |
|
5831 | 5839 | self.comboTypeBox.addItem("SpectraHeis") |
|
5832 | 5840 | self.comboTypeBox.addItem("Correlation") |
|
5833 | 5841 | if name == 'SpectraHeis': |
|
5834 | 5842 | self.comboTypeBox.clear() |
|
5835 | 5843 | self.comboTypeBox.addItem("SpectraHeis") |
|
5836 | 5844 | |
|
5837 | 5845 | self.comboInputBox.addItem(str(name)) |
|
5838 | 5846 | # self.comboInputBox.addItem(str(name)+str(id)) |
|
5839 | 5847 | |
|
5840 | 5848 | def closeEvent(self, event): |
|
5841 | 5849 | self.closed.emit() |
|
5842 | 5850 | event.accept() |
|
5843 | 5851 | |
|
5844 | 5852 | class Ftp(QMainWindow, Ui_Ftp): |
|
5845 | 5853 | """ |
|
5846 | 5854 | Class documentation goes here. |
|
5847 | 5855 | """ |
|
5848 | 5856 | create = False |
|
5849 | 5857 | closed = pyqtSignal() |
|
5850 | 5858 | server = None |
|
5851 | 5859 | remotefolder = None |
|
5852 | 5860 | username = None |
|
5853 | 5861 | password = None |
|
5854 | 5862 | ftp_wei = None |
|
5855 | 5863 | exp_code = None |
|
5856 | 5864 | sub_exp_code = None |
|
5857 | 5865 | plot_pos = None |
|
5858 | 5866 | |
|
5859 | 5867 | def __init__(self, parent=None): |
|
5860 | 5868 | """ |
|
5861 | 5869 | Constructor |
|
5862 | 5870 | """ |
|
5863 | 5871 | QMainWindow.__init__(self, parent) |
|
5864 | 5872 | self.setupUi(self) |
|
5865 | 5873 | self.setGUIStatus() |
|
5866 | 5874 | |
|
5867 | 5875 | def setGUIStatus(self): |
|
5868 | 5876 | self.setWindowTitle("ROJ-Signal Chain") |
|
5869 | 5877 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') |
|
5870 | 5878 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') |
|
5871 | 5879 | self.usernameFTP.setToolTip('Example: myusername') |
|
5872 | 5880 | self.passwordFTP.setToolTip('Example: mypass ') |
|
5873 | 5881 | self.weightFTP.setToolTip('Example: 0') |
|
5874 | 5882 | self.expcodeFTP.setToolTip('Example: 0') |
|
5875 | 5883 | self.subexpFTP.setToolTip('Example: 0') |
|
5876 | 5884 | self.plotposFTP.setToolTip('Example: 0') |
|
5877 | 5885 | |
|
5878 | 5886 | def setParmsfromTemporal(self, server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos): |
|
5879 | 5887 | self.serverFTP.setText(str(server)) |
|
5880 | 5888 | self.folderFTP.setText(str(remotefolder)) |
|
5881 | 5889 | self.usernameFTP.setText(str(username)) |
|
5882 | 5890 | self.passwordFTP.setText(str(password)) |
|
5883 | 5891 | self.weightFTP.setText(str(ftp_wei)) |
|
5884 | 5892 | self.expcodeFTP.setText(str(exp_code)) |
|
5885 | 5893 | self.subexpFTP.setText(str(sub_exp_code)) |
|
5886 | 5894 | self.plotposFTP.setText(str(plot_pos)) |
|
5887 | 5895 | |
|
5888 | 5896 | def getParmsFromFtpWindow(self): |
|
5889 | 5897 | """ |
|
5890 | 5898 | Return Inputs Project: |
|
5891 | 5899 | - server |
|
5892 | 5900 | - remotefolder |
|
5893 | 5901 | - username |
|
5894 | 5902 | - password |
|
5895 | 5903 | - ftp_wei |
|
5896 | 5904 | - exp_code |
|
5897 | 5905 | - sub_exp_code |
|
5898 | 5906 | - plot_pos |
|
5899 | 5907 | """ |
|
5900 | 5908 | name_server_ftp = str(self.serverFTP.text()) |
|
5901 | 5909 | if not name_server_ftp: |
|
5902 | 5910 | self.console.clear() |
|
5903 | 5911 | self.console.append("Please Write a FTP Server") |
|
5904 | 5912 | return 0 |
|
5905 | 5913 | |
|
5906 | 5914 | folder_server_ftp = str(self.folderFTP.text()) |
|
5907 | 5915 | if not folder_server_ftp: |
|
5908 | 5916 | self.console.clear() |
|
5909 | 5917 | self.console.append("Please Write a Folder") |
|
5910 | 5918 | return 0 |
|
5911 | 5919 | |
|
5912 | 5920 | username_ftp = str(self.usernameFTP.text()) |
|
5913 | 5921 | if not username_ftp: |
|
5914 | 5922 | self.console.clear() |
|
5915 | 5923 | self.console.append("Please Write a User Name") |
|
5916 | 5924 | return 0 |
|
5917 | 5925 | |
|
5918 | 5926 | password_ftp = str(self.passwordFTP.text()) |
|
5919 | 5927 | if not password_ftp: |
|
5920 | 5928 | self.console.clear() |
|
5921 | 5929 | self.console.append("Please Write a passwordFTP") |
|
5922 | 5930 | return 0 |
|
5923 | 5931 | |
|
5924 | 5932 | ftp_wei = str(self.weightFTP.text()) |
|
5925 | 5933 | if not ftp_wei == "": |
|
5926 | 5934 | try: |
|
5927 | 5935 | ftp_wei = int(self.weightFTP.text()) |
|
5928 | 5936 | except: |
|
5929 | 5937 | self.console.clear() |
|
5930 | 5938 | self.console.append("Please Write a ftp_wei number") |
|
5931 | 5939 | return 0 |
|
5932 | 5940 | |
|
5933 | 5941 | exp_code = str(self.expcodeFTP.text()) |
|
5934 | 5942 | if not exp_code == "": |
|
5935 | 5943 | try: |
|
5936 | 5944 | exp_code = int(self.expcodeFTP.text()) |
|
5937 | 5945 | except: |
|
5938 | 5946 | self.console.clear() |
|
5939 | 5947 | self.console.append("Please Write a exp_code number") |
|
5940 | 5948 | return 0 |
|
5941 | 5949 | |
|
5942 | 5950 | |
|
5943 | 5951 | sub_exp_code = str(self.subexpFTP.text()) |
|
5944 | 5952 | if not sub_exp_code == "": |
|
5945 | 5953 | try: |
|
5946 | 5954 | sub_exp_code = int(self.subexpFTP.text()) |
|
5947 | 5955 | except: |
|
5948 | 5956 | self.console.clear() |
|
5949 | 5957 | self.console.append("Please Write a sub_exp_code number") |
|
5950 | 5958 | return 0 |
|
5951 | 5959 | |
|
5952 | 5960 | plot_pos = str(self.plotposFTP.text()) |
|
5953 | 5961 | if not plot_pos == "": |
|
5954 | 5962 | try: |
|
5955 | 5963 | plot_pos = int(self.plotposFTP.text()) |
|
5956 | 5964 | except: |
|
5957 | 5965 | self.console.clear() |
|
5958 | 5966 | self.console.append("Please Write a plot_pos number") |
|
5959 | 5967 | return 0 |
|
5960 | 5968 | |
|
5961 | 5969 | return name_server_ftp, folder_server_ftp, username_ftp, password_ftp, ftp_wei, exp_code, sub_exp_code, plot_pos |
|
5962 | 5970 | |
|
5963 | 5971 | @pyqtSignature("") |
|
5964 | 5972 | def on_ftpOkButton_clicked(self): |
|
5965 | 5973 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.getParmsFromFtpWindow() |
|
5966 | 5974 | self.create = True |
|
5967 | 5975 | self.close() |
|
5968 | 5976 | |
|
5969 | 5977 | @pyqtSignature("") |
|
5970 | 5978 | def on_ftpCancelButton_clicked(self): |
|
5971 | 5979 | self.create = False |
|
5972 | 5980 | self.close() |
|
5973 | 5981 | |
|
5974 | 5982 | def closeEvent(self, event): |
|
5975 | 5983 | self.closed.emit() |
|
5976 | 5984 | event.accept() |
|
5977 | 5985 | |
|
5978 | 5986 | class ftpBuffer(): |
|
5979 | 5987 | |
|
5980 | 5988 | server = None |
|
5981 | 5989 | remotefolder = None |
|
5982 | 5990 | username = None |
|
5983 | 5991 | password = None |
|
5984 | 5992 | ftp_wei = None |
|
5985 | 5993 | exp_code = None |
|
5986 | 5994 | sub_exp_code = None |
|
5987 | 5995 | plot_pos = None |
|
5988 | 5996 | create = False |
|
5989 | 5997 | withoutconfig = False |
|
5990 | 5998 | createforView = False |
|
5991 | 5999 | localfolder = None |
|
5992 | 6000 | extension = None |
|
5993 | 6001 | period = None |
|
5994 | 6002 | protocol = None |
|
5995 | 6003 | |
|
5996 | 6004 | def __init__(self): |
|
5997 | 6005 | |
|
5998 | 6006 | self.create = False |
|
5999 | 6007 | self.server = None |
|
6000 | 6008 | self.remotefolder = None |
|
6001 | 6009 | self.username = None |
|
6002 | 6010 | self.password = None |
|
6003 | 6011 | self.ftp_wei = None |
|
6004 | 6012 | self.exp_code = None |
|
6005 | 6013 | self.sub_exp_code = None |
|
6006 | 6014 | self.plot_pos = None |
|
6007 | 6015 | # self.create = False |
|
6008 | 6016 | self.localfolder = None |
|
6009 | 6017 | self.extension = None |
|
6010 | 6018 | self.period = None |
|
6011 | 6019 | self.protocol = None |
|
6012 | 6020 | |
|
6013 | 6021 | def setwithoutconfiguration(self): |
|
6014 | 6022 | |
|
6015 | 6023 | self.create = False |
|
6016 | 6024 | self.server = "jro-app.igp.gob.pe" |
|
6017 | 6025 | self.remotefolder = "/home/wmaster/graficos" |
|
6018 | 6026 | self.username = "wmaster" |
|
6019 | 6027 | self.password = "mst2010vhf" |
|
6020 | 6028 | self.withoutconfig = True |
|
6021 | 6029 | self.localfolder = './' |
|
6022 | 6030 | self.extension = '.png' |
|
6023 | 6031 | self.period = 60 |
|
6024 | 6032 | self.protocol = 'ftp' |
|
6025 | 6033 | self.createforView = True |
|
6026 | 6034 | |
|
6027 | 6035 | if not self.ftp_wei: |
|
6028 | 6036 | self.ftp_wei = 0 |
|
6029 | 6037 | |
|
6030 | 6038 | if not self.exp_code: |
|
6031 | 6039 | self.exp_code = 0 |
|
6032 | 6040 | |
|
6033 | 6041 | if not self.sub_exp_code: |
|
6034 | 6042 | self.sub_exp_code = 0 |
|
6035 | 6043 | |
|
6036 | 6044 | if not self.plot_pos: |
|
6037 | 6045 | self.plot_pos = 0 |
|
6038 | 6046 | |
|
6039 | 6047 | def save(self, server, remotefolder, username, password, ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, localfolder='./', extension='.png', period=60, protocol='ftp'): |
|
6040 | 6048 | |
|
6041 | 6049 | self.server = server |
|
6042 | 6050 | self.remotefolder = remotefolder |
|
6043 | 6051 | self.username = username |
|
6044 | 6052 | self.password = password |
|
6045 | 6053 | self.ftp_wei = ftp_wei |
|
6046 | 6054 | self.exp_code = exp_code |
|
6047 | 6055 | self.sub_exp_code = sub_exp_code |
|
6048 | 6056 | self.plot_pos = plot_pos |
|
6049 | 6057 | self.create = True |
|
6050 | 6058 | self.withoutconfig = False |
|
6051 | 6059 | self.createforView = True |
|
6052 | 6060 | self.localfolder = localfolder |
|
6053 | 6061 | self.extension = extension |
|
6054 | 6062 | self.period = period |
|
6055 | 6063 | self.protocol = protocol |
|
6056 | 6064 | |
|
6057 | 6065 | def recover(self): |
|
6058 | 6066 | |
|
6059 | 6067 | return self.server, self.remotefolder, self.username, self.password, self.ftp_wei, self.exp_code, self.sub_exp_code, self.plot_pos, self.extension, self.period, self.protocol |
|
6060 | 6068 | |
|
6061 | 6069 | class ShowMeConsole(QtCore.QObject): |
|
6062 | 6070 | |
|
6063 | 6071 | textWritten = QtCore.pyqtSignal(str) |
|
6064 | 6072 | |
|
6065 | 6073 | def write(self, text): |
|
6066 | 6074 | |
|
6067 | 6075 | if len(text) == 0: |
|
6068 | 6076 | self.textWritten.emit("\n") |
|
6069 | 6077 | return |
|
6070 | 6078 | |
|
6071 | 6079 | if text[-1] == "\n": |
|
6072 | 6080 | text = text[:-1] |
|
6073 | 6081 | |
|
6074 | 6082 | self.textWritten.emit(str(text)) |
@@ -1,528 +1,528 | |||
|
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 | |
|
32 | 32 | self.specOpOk = QtGui.QPushButton(self.frame_5) |
|
33 | 33 | self.specOpOk.setObjectName(_fromUtf8("specOpOk")) |
|
34 | 34 | self.gridLayout_18.addWidget(self.specOpOk, 0, 0, 1, 1) |
|
35 | 35 | |
|
36 | 36 | self.specGraphClear = QtGui.QPushButton(self.frame_5) |
|
37 | 37 | self.specGraphClear.setObjectName(_fromUtf8("specGraphClear")) |
|
38 | 38 | self.gridLayout_18.addWidget(self.specGraphClear, 0, 1, 1, 1) |
|
39 | 39 | |
|
40 | 40 | self.gridLayout_7.addWidget(self.frame_5, 1, 1, 1, 1) |
|
41 | 41 | |
|
42 | 42 | self.tabWidgetSpectra = QtGui.QTabWidget(self.tabSpectra) |
|
43 | 43 | self.tabWidgetSpectra.setObjectName(_fromUtf8("tabWidgetSpectra")) |
|
44 | 44 | |
|
45 | 45 | self.tabopSpectra = QtGui.QWidget() |
|
46 | 46 | self.tabopSpectra.setObjectName(_fromUtf8("tabopSpectra")) |
|
47 | 47 | |
|
48 | 48 | self.gridLayout_5 = QtGui.QGridLayout(self.tabopSpectra) |
|
49 | 49 | self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5")) |
|
50 | 50 | |
|
51 | 51 | |
|
52 | 52 | |
|
53 | 53 | self.specOpCebRadarfrequency = QtGui.QCheckBox(self.tabopSpectra) |
|
54 | 54 | self.specOpCebRadarfrequency.setObjectName(_fromUtf8("specOpCebRadarfrequency")) |
|
55 | 55 | self.gridLayout_5.addWidget(self.specOpCebRadarfrequency, 0, 0, 1, 1) |
|
56 | 56 | |
|
57 | 57 | self.specOpRadarfrequency = QtGui.QLineEdit(self.tabopSpectra) |
|
58 | 58 | self.specOpRadarfrequency.setObjectName(_fromUtf8("specOpRadarfrequency")) |
|
59 | 59 | self.gridLayout_5.addWidget(self.specOpRadarfrequency, 0, 1, 1, 4) |
|
60 | 60 | |
|
61 | 61 | |
|
62 | 62 | self.specLabProfiles = QtGui.QLabel(self.tabopSpectra) |
|
63 | 63 | self.specLabProfiles.setObjectName(_fromUtf8("specLabProfiles")) |
|
64 | 64 | self.gridLayout_5.addWidget(self.specLabProfiles, 1, 0, 1, 1) |
|
65 | 65 | |
|
66 | 66 | self.specOpProfiles = QtGui.QLineEdit(self.tabopSpectra) |
|
67 | 67 | self.specOpProfiles.setObjectName(_fromUtf8("specOpProfiles")) |
|
68 | 68 | self.gridLayout_5.addWidget(self.specOpProfiles, 1, 1, 1, 4) |
|
69 | 69 | |
|
70 | 70 | |
|
71 | 71 | self.specLabnFFTPoints = QtGui.QLabel(self.tabopSpectra) |
|
72 | 72 | self.specLabnFFTPoints.setObjectName(_fromUtf8("specLabnFFTPoints")) |
|
73 | 73 | self.gridLayout_5.addWidget(self.specLabnFFTPoints, 2, 0, 1, 1) |
|
74 | 74 | |
|
75 | 75 | self.specOpnFFTpoints = QtGui.QLineEdit(self.tabopSpectra) |
|
76 | 76 | self.specOpnFFTpoints.setObjectName(_fromUtf8("specOpnFFTpoints")) |
|
77 | 77 | self.gridLayout_5.addWidget(self.specOpnFFTpoints, 2, 1, 1, 4) |
|
78 | 78 | |
|
79 | 79 | |
|
80 | 80 | self.specLabippFactor = QtGui.QLabel(self.tabopSpectra) |
|
81 | 81 | self.specLabippFactor.setObjectName(_fromUtf8("specLabippFactor")) |
|
82 | 82 | self.gridLayout_5.addWidget(self.specLabippFactor, 3, 0, 1, 1) |
|
83 | 83 | |
|
84 | 84 | self.specOpippFactor = QtGui.QLineEdit(self.tabopSpectra) |
|
85 | 85 | self.specOpippFactor.setObjectName(_fromUtf8("specOpippFactor")) |
|
86 | 86 | self.gridLayout_5.addWidget(self.specOpippFactor, 3, 1, 1, 4) |
|
87 | 87 | |
|
88 | 88 | |
|
89 | 89 | self.specOpCebChannel = QtGui.QCheckBox(self.tabopSpectra) |
|
90 | 90 | self.specOpCebChannel.setObjectName(_fromUtf8("specOpCebChannel")) |
|
91 | 91 | self.gridLayout_5.addWidget(self.specOpCebChannel, 4, 0, 1, 1) |
|
92 | 92 | |
|
93 | 93 | self.specOpComChannel = QtGui.QComboBox(self.tabopSpectra) |
|
94 | 94 | self.specOpComChannel.setObjectName(_fromUtf8("specOpComChannel")) |
|
95 | 95 | self.specOpComChannel.addItem(_fromUtf8("")) |
|
96 | 96 | self.specOpComChannel.addItem(_fromUtf8("")) |
|
97 | 97 | self.gridLayout_5.addWidget(self.specOpComChannel, 4, 1, 1, 2) |
|
98 | 98 | |
|
99 | 99 | self.specOpChannel = QtGui.QLineEdit(self.tabopSpectra) |
|
100 | 100 | self.specOpChannel.setObjectName(_fromUtf8("specOpChannel")) |
|
101 | 101 | self.gridLayout_5.addWidget(self.specOpChannel, 4, 3, 1, 2) |
|
102 | 102 | |
|
103 | 103 | |
|
104 | 104 | self.specOpCebCrossSpectra = QtGui.QCheckBox(self.tabopSpectra) |
|
105 | 105 | self.specOpCebCrossSpectra.setObjectName(_fromUtf8("specOpCebCrossSpectra")) |
|
106 | 106 | self.gridLayout_5.addWidget(self.specOpCebCrossSpectra, 5, 0, 1, 1) |
|
107 | 107 | |
|
108 | 108 | self.specOpComCrossSpectra = QtGui.QComboBox(self.tabopSpectra) |
|
109 | 109 | self.specOpComCrossSpectra.setObjectName(_fromUtf8("specOpComCrossSpectra")) |
|
110 | 110 | self.specOpComCrossSpectra.addItem(_fromUtf8("")) |
|
111 | 111 | self.gridLayout_5.addWidget(self.specOpComCrossSpectra, 5, 1, 1, 2) |
|
112 | 112 | |
|
113 | 113 | self.specOppairsList = QtGui.QLineEdit(self.tabopSpectra) |
|
114 | 114 | self.specOppairsList.setObjectName(_fromUtf8("specOppairsList")) |
|
115 | 115 | self.gridLayout_5.addWidget(self.specOppairsList, 5, 3, 1, 2) |
|
116 | 116 | |
|
117 | 117 | |
|
118 | 118 | self.specOpCebHeights = QtGui.QCheckBox(self.tabopSpectra) |
|
119 | 119 | self.specOpCebHeights.setObjectName(_fromUtf8("specOpCebHeights")) |
|
120 | 120 | self.gridLayout_5.addWidget(self.specOpCebHeights, 6, 0, 1, 1) |
|
121 | 121 | |
|
122 | 122 | self.specOpComHeights = QtGui.QComboBox(self.tabopSpectra) |
|
123 | 123 | self.specOpComHeights.setObjectName(_fromUtf8("specOpComHeights")) |
|
124 | 124 | self.specOpComHeights.addItem(_fromUtf8("")) |
|
125 | 125 | self.specOpComHeights.addItem(_fromUtf8("")) |
|
126 | 126 | self.gridLayout_5.addWidget(self.specOpComHeights, 6, 1, 1, 2) |
|
127 | 127 | |
|
128 | 128 | self.specOpHeights = QtGui.QLineEdit(self.tabopSpectra) |
|
129 | 129 | self.specOpHeights.setObjectName(_fromUtf8("specOpHeights")) |
|
130 | 130 | self.gridLayout_5.addWidget(self.specOpHeights, 6, 3, 1, 2) |
|
131 | 131 | |
|
132 | 132 | |
|
133 | 133 | self.specOpCebIncoherent = QtGui.QCheckBox(self.tabopSpectra) |
|
134 | 134 | self.specOpCebIncoherent.setObjectName(_fromUtf8("specOpCebIncoherent")) |
|
135 | 135 | self.gridLayout_5.addWidget(self.specOpCebIncoherent, 7, 0, 1, 1) |
|
136 | 136 | |
|
137 | 137 | self.specOpCobIncInt = QtGui.QComboBox(self.tabopSpectra) |
|
138 | 138 | self.specOpCobIncInt.setObjectName(_fromUtf8("specOpCobIncInt")) |
|
139 | 139 | self.specOpCobIncInt.addItem(_fromUtf8("")) |
|
140 | 140 | self.specOpCobIncInt.addItem(_fromUtf8("")) |
|
141 | 141 | self.gridLayout_5.addWidget(self.specOpCobIncInt, 7, 1, 1, 2) |
|
142 | 142 | |
|
143 | 143 | self.specOpIncoherent = QtGui.QLineEdit(self.tabopSpectra) |
|
144 | 144 | self.specOpIncoherent.setObjectName(_fromUtf8("specOpIncoherent")) |
|
145 | 145 | self.gridLayout_5.addWidget(self.specOpIncoherent, 7, 3, 1, 2) |
|
146 | 146 | |
|
147 | 147 | |
|
148 | 148 | self.specOpCebRemoveDC = QtGui.QCheckBox(self.tabopSpectra) |
|
149 | 149 | self.specOpCebRemoveDC.setObjectName(_fromUtf8("specOpCebRemoveDC")) |
|
150 | 150 | self.gridLayout_5.addWidget(self.specOpCebRemoveDC, 8, 0, 1, 1) |
|
151 | 151 | |
|
152 | 152 | self.specOpComRemoveDC = QtGui.QComboBox(self.tabopSpectra) |
|
153 | 153 | self.specOpComRemoveDC.setObjectName(_fromUtf8("specOpComRemoveDC")) |
|
154 | 154 | self.specOpComRemoveDC.addItem(_fromUtf8("")) |
|
155 | 155 | self.specOpComRemoveDC.addItem(_fromUtf8("")) |
|
156 | 156 | self.gridLayout_5.addWidget(self.specOpComRemoveDC, 8, 1, 1, 2) |
|
157 | 157 | |
|
158 | 158 | |
|
159 | 159 | self.specOpCebRemoveInt = QtGui.QCheckBox(self.tabopSpectra) |
|
160 | 160 | self.specOpCebRemoveInt.setObjectName(_fromUtf8("specOpCebRemoveInt")) |
|
161 | 161 | self.gridLayout_5.addWidget(self.specOpCebRemoveInt, 9, 0, 1, 1) |
|
162 | 162 | |
|
163 | 163 | |
|
164 | 164 | self.specOpCebgetNoise = QtGui.QCheckBox(self.tabopSpectra) |
|
165 | 165 | self.specOpCebgetNoise.setObjectName(_fromUtf8("specOpCebgetNoise")) |
|
166 | 166 | self.gridLayout_5.addWidget(self.specOpCebgetNoise, 10, 0, 1, 1) |
|
167 | 167 | |
|
168 | 168 | self.specOpgetNoise = QtGui.QLineEdit(self.tabopSpectra) |
|
169 | 169 | self.specOpgetNoise.setObjectName(_fromUtf8("specOpgetNoise")) |
|
170 | 170 | self.gridLayout_5.addWidget(self.specOpgetNoise, 10, 1, 1, 4) |
|
171 | 171 | |
|
172 | 172 | # spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
173 | 173 | # self.gridLayout_5.addItem(spacerItem9, 12, 3, 1, 1) |
|
174 | 174 | # |
|
175 | 175 | # spacerItem10 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
176 | 176 | # self.gridLayout_5.addItem(spacerItem10, 9, 3, 1, 1) |
|
177 | 177 | # |
|
178 | 178 | # spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
179 | 179 | # self.gridLayout_5.addItem(spacerItem11, 7, 3, 1, 1) |
|
180 | 180 | # |
|
181 | 181 | # spacerItem12 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
182 | 182 | # self.gridLayout_5.addItem(spacerItem12, 4, 3, 1, 1) |
|
183 | 183 | # |
|
184 | 184 | # spacerItem13 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
185 | 185 | # self.gridLayout_5.addItem(spacerItem13, 15, 3, 1, 1) |
|
186 | 186 | |
|
187 | 187 | |
|
188 | 188 | self.tabWidgetSpectra.addTab(self.tabopSpectra, _fromUtf8("")) |
|
189 | 189 | |
|
190 | 190 | ################################################################ |
|
191 | 191 | ################################################################ |
|
192 | 192 | |
|
193 | 193 | self.tabgraphSpectra = QtGui.QWidget() |
|
194 | 194 | self.tabgraphSpectra.setObjectName(_fromUtf8("tabgraphSpectra")) |
|
195 | 195 | self.gridLayout_9 = QtGui.QGridLayout(self.tabgraphSpectra) |
|
196 | 196 | self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9")) |
|
197 | 197 | |
|
198 | 198 | # spacerItem14 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
199 | 199 | # self.gridLayout_9.addItem(spacerItem14, 14, 2, 1, 1) |
|
200 | 200 | xi = 0 |
|
201 | 201 | |
|
202 | 202 | self.label_24 = QtGui.QLabel(self.tabgraphSpectra) |
|
203 | 203 | self.label_24.setObjectName(_fromUtf8("label_24")) |
|
204 | 204 | self.gridLayout_9.addWidget(self.label_24, xi, 0, 1, 1) |
|
205 | 205 | |
|
206 | 206 | self.specGraphPath = QtGui.QLineEdit(self.tabgraphSpectra) |
|
207 | 207 | self.specGraphPath.setObjectName(_fromUtf8("specGraphPath")) |
|
208 | 208 | self.gridLayout_9.addWidget(self.specGraphPath, xi, 1, 1, 6) |
|
209 | 209 | |
|
210 | 210 | self.specGraphToolPath = QtGui.QToolButton(self.tabgraphSpectra) |
|
211 | 211 | self.specGraphToolPath.setObjectName(_fromUtf8("specGraphToolPath")) |
|
212 | 212 | self.gridLayout_9.addWidget(self.specGraphToolPath, xi, 7, 1, 1) |
|
213 | 213 | |
|
214 | 214 | self.label_25 = QtGui.QLabel(self.tabgraphSpectra) |
|
215 | 215 | self.label_25.setObjectName(_fromUtf8("label_25")) |
|
216 | 216 | self.gridLayout_9.addWidget(self.label_25, xi+1, 0, 1, 1) |
|
217 | 217 | self.specGraphPrefix = QtGui.QLineEdit(self.tabgraphSpectra) |
|
218 | 218 | self.specGraphPrefix.setObjectName(_fromUtf8("specGraphPrefix")) |
|
219 | 219 | self.gridLayout_9.addWidget(self.specGraphPrefix, xi+1, 1, 1, 7) |
|
220 | 220 | |
|
221 | 221 | xi = 2 |
|
222 | 222 | |
|
223 | 223 | self.label_40 = QtGui.QLabel(self.tabgraphSpectra) |
|
224 | 224 | self.label_40.setObjectName(_fromUtf8("label_40")) |
|
225 | 225 | self.gridLayout_9.addWidget(self.label_40, xi+1, 0, 1, 1) |
|
226 | 226 | self.label_41 = QtGui.QLabel(self.tabgraphSpectra) |
|
227 | 227 | self.label_41.setObjectName(_fromUtf8("label_41")) |
|
228 | 228 | self.gridLayout_9.addWidget(self.label_41, xi+2, 0, 1, 1) |
|
229 | 229 | self.label_42 = QtGui.QLabel(self.tabgraphSpectra) |
|
230 | 230 | self.label_42.setObjectName(_fromUtf8("label_42")) |
|
231 | 231 | self.gridLayout_9.addWidget(self.label_42, xi+3, 0, 1, 1) |
|
232 | 232 | self.label_44 = QtGui.QLabel(self.tabgraphSpectra) |
|
233 | 233 | self.label_44.setObjectName(_fromUtf8("label_44")) |
|
234 | 234 | self.gridLayout_9.addWidget(self.label_44, xi+4, 0, 1, 1) |
|
235 | 235 | self.label_46 = QtGui.QLabel(self.tabgraphSpectra) |
|
236 | 236 | self.label_46.setObjectName(_fromUtf8("label_46")) |
|
237 | 237 | self.gridLayout_9.addWidget(self.label_46, xi+5, 0, 1, 1) |
|
238 | 238 | self.label_45 = QtGui.QLabel(self.tabgraphSpectra) |
|
239 | 239 | self.label_45.setObjectName(_fromUtf8("label_45")) |
|
240 | 240 | self.gridLayout_9.addWidget(self.label_45, xi+6, 0, 1, 1) |
|
241 | 241 | |
|
242 | 242 | self.label_43 = QtGui.QLabel(self.tabgraphSpectra) |
|
243 | 243 | self.label_43.setObjectName(_fromUtf8("label_43")) |
|
244 | 244 | self.gridLayout_9.addWidget(self.label_43, xi, 3, 1, 1) |
|
245 | 245 | self.specGraphCebSpectraplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
246 | 246 | self.specGraphCebSpectraplot.setText(_fromUtf8("")) |
|
247 | 247 | self.specGraphCebSpectraplot.setObjectName(_fromUtf8("specGraphCebSpectraplot")) |
|
248 | 248 | self.gridLayout_9.addWidget(self.specGraphCebSpectraplot, xi+1, 3, 1, 1) |
|
249 | 249 | self.specGraphCebCrossSpectraplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
250 | 250 | self.specGraphCebCrossSpectraplot.setText(_fromUtf8("")) |
|
251 | 251 | self.specGraphCebCrossSpectraplot.setObjectName(_fromUtf8("specGraphCebCrossSpectraplot")) |
|
252 | 252 | self.gridLayout_9.addWidget(self.specGraphCebCrossSpectraplot, xi+2, 3, 1, 1) |
|
253 | 253 | self.specGraphCebRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
254 | 254 | self.specGraphCebRTIplot.setText(_fromUtf8("")) |
|
255 | 255 | self.specGraphCebRTIplot.setObjectName(_fromUtf8("specGraphCebRTIplot")) |
|
256 | 256 | self.gridLayout_9.addWidget(self.specGraphCebRTIplot, xi+3, 3, 1, 1) |
|
257 | 257 | self.specGraphCebCoherencmap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
258 | 258 | self.specGraphCebCoherencmap.setText(_fromUtf8("")) |
|
259 | 259 | self.specGraphCebCoherencmap.setObjectName(_fromUtf8("specGraphCebCoherencmap")) |
|
260 | 260 | self.gridLayout_9.addWidget(self.specGraphCebCoherencmap, xi+4, 3, 1, 1) |
|
261 | 261 | self.specGraphPowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) |
|
262 | 262 | self.specGraphPowerprofile.setText(_fromUtf8("")) |
|
263 | 263 | self.specGraphPowerprofile.setObjectName(_fromUtf8("specGraphPowerprofile")) |
|
264 | 264 | self.gridLayout_9.addWidget(self.specGraphPowerprofile, xi+5, 3, 1, 1) |
|
265 | 265 | self.specGraphCebRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) |
|
266 | 266 | self.specGraphCebRTInoise.setText(_fromUtf8("")) |
|
267 | 267 | self.specGraphCebRTInoise.setObjectName(_fromUtf8("specGraphCebRTInoise")) |
|
268 | 268 | self.gridLayout_9.addWidget(self.specGraphCebRTInoise, xi+6, 3, 1, 1) |
|
269 | 269 | |
|
270 | 270 | # spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
271 | 271 | # self.gridLayout_9.addItem(spacerItem18, 4, 3, 1, 1) |
|
272 | 272 | |
|
273 | 273 | self.label_47 = QtGui.QLabel(self.tabgraphSpectra) |
|
274 | 274 | self.label_47.setObjectName(_fromUtf8("label_47")) |
|
275 | 275 | self.gridLayout_9.addWidget(self.label_47, xi, 5, 1, 1) |
|
276 | 276 | self.specGraphSaveSpectra = QtGui.QCheckBox(self.tabgraphSpectra) |
|
277 | 277 | self.specGraphSaveSpectra.setText(_fromUtf8("")) |
|
278 | 278 | self.specGraphSaveSpectra.setObjectName(_fromUtf8("specGraphSaveSpectra")) |
|
279 | 279 | self.gridLayout_9.addWidget(self.specGraphSaveSpectra, xi+1, 5, 1, 1) |
|
280 | 280 | self.specGraphSaveCross = QtGui.QCheckBox(self.tabgraphSpectra) |
|
281 | 281 | self.specGraphSaveCross.setText(_fromUtf8("")) |
|
282 | 282 | self.specGraphSaveCross.setObjectName(_fromUtf8("specGraphSaveCross")) |
|
283 | 283 | self.gridLayout_9.addWidget(self.specGraphSaveCross, xi+2, 5, 1, 1) |
|
284 | 284 | self.specGraphSaveRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
285 | 285 | self.specGraphSaveRTIplot.setText(_fromUtf8("")) |
|
286 | 286 | self.specGraphSaveRTIplot.setObjectName(_fromUtf8("specGraphSaveRTIplot")) |
|
287 | 287 | self.gridLayout_9.addWidget(self.specGraphSaveRTIplot, xi+3, 5, 1, 1) |
|
288 | 288 | self.specGraphSaveCoherencemap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
289 | 289 | self.specGraphSaveCoherencemap.setText(_fromUtf8("")) |
|
290 | 290 | self.specGraphSaveCoherencemap.setObjectName(_fromUtf8("specGraphSaveCoherencemap")) |
|
291 | 291 | self.gridLayout_9.addWidget(self.specGraphSaveCoherencemap, xi+4, 5, 1, 1) |
|
292 | 292 | self.specGraphSavePowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) |
|
293 | 293 | self.specGraphSavePowerprofile.setText(_fromUtf8("")) |
|
294 | 294 | self.specGraphSavePowerprofile.setObjectName(_fromUtf8("specGraphSavePowerprofile")) |
|
295 | 295 | self.gridLayout_9.addWidget(self.specGraphSavePowerprofile, xi+5, 5, 1, 1) |
|
296 | 296 | self.specGraphSaveRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) |
|
297 | 297 | self.specGraphSaveRTInoise.setText(_fromUtf8("")) |
|
298 | 298 | self.specGraphSaveRTInoise.setObjectName(_fromUtf8("specGraphSaveRTInoise")) |
|
299 | 299 | self.gridLayout_9.addWidget(self.specGraphSaveRTInoise, xi+6, 5, 1, 1) |
|
300 | 300 | |
|
301 | 301 | self.label_19 = QtGui.QLabel(self.tabgraphSpectra) |
|
302 | 302 | self.label_19.setObjectName(_fromUtf8("label_19")) |
|
303 | 303 | self.gridLayout_9.addWidget(self.label_19, xi, 7, 1, 1) |
|
304 | 304 | self.specGraphftpSpectra = QtGui.QCheckBox(self.tabgraphSpectra) |
|
305 | 305 | self.specGraphftpSpectra.setText(_fromUtf8("")) |
|
306 | 306 | self.specGraphftpSpectra.setObjectName(_fromUtf8("specGraphftpSpectra")) |
|
307 | 307 | self.gridLayout_9.addWidget(self.specGraphftpSpectra, xi+1, 7, 1, 1) |
|
308 | 308 | self.specGraphftpCross = QtGui.QCheckBox(self.tabgraphSpectra) |
|
309 | 309 | self.specGraphftpCross.setText(_fromUtf8("")) |
|
310 | 310 | self.specGraphftpCross.setObjectName(_fromUtf8("specGraphftpCross")) |
|
311 | 311 | self.gridLayout_9.addWidget(self.specGraphftpCross, xi+2, 7, 1, 1) |
|
312 | 312 | self.specGraphftpRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
313 | 313 | self.specGraphftpRTIplot.setText(_fromUtf8("")) |
|
314 | 314 | self.specGraphftpRTIplot.setObjectName(_fromUtf8("specGraphftpRTIplot")) |
|
315 | 315 | self.gridLayout_9.addWidget(self.specGraphftpRTIplot, xi+3, 7, 1, 1) |
|
316 | 316 | self.specGraphftpCoherencemap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
317 | 317 | self.specGraphftpCoherencemap.setText(_fromUtf8("")) |
|
318 | 318 | self.specGraphftpCoherencemap.setObjectName(_fromUtf8("specGraphftpCoherencemap")) |
|
319 | 319 | self.gridLayout_9.addWidget(self.specGraphftpCoherencemap, xi+4, 7, 1, 1) |
|
320 | 320 | self.specGraphftpPowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) |
|
321 | 321 | self.specGraphftpPowerprofile.setText(_fromUtf8("")) |
|
322 | 322 | self.specGraphftpPowerprofile.setObjectName(_fromUtf8("specGraphftpPowerprofile")) |
|
323 | 323 | self.gridLayout_9.addWidget(self.specGraphftpPowerprofile, xi+5, 7, 1, 1) |
|
324 | 324 | self.specGraphftpRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) |
|
325 | 325 | self.specGraphftpRTInoise.setText(_fromUtf8("")) |
|
326 | 326 | self.specGraphftpRTInoise.setObjectName(_fromUtf8("specGraphftpRTInoise")) |
|
327 | 327 | self.gridLayout_9.addWidget(self.specGraphftpRTInoise, xi+6, 7, 1, 1) |
|
328 | 328 | |
|
329 | 329 | # spacerItem19 = QtGui.QSpacerItem(39, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
330 | 330 | # self.gridLayout_9.addItem(spacerItem19, 27, 4, 1, 1) |
|
331 | 331 | |
|
332 | 332 | xi = 11 |
|
333 | 333 | |
|
334 | 334 | self.label_22 = QtGui.QLabel(self.tabgraphSpectra) |
|
335 | 335 | self.label_22.setObjectName(_fromUtf8("label_22")) |
|
336 | 336 | self.gridLayout_9.addWidget(self.label_22, xi, 0, 1, 1) |
|
337 | 337 | self.specGgraphFreq = QtGui.QLineEdit(self.tabgraphSpectra) |
|
338 | 338 | self.specGgraphFreq.setObjectName(_fromUtf8("specGgraphFreq")) |
|
339 | 339 | self.gridLayout_9.addWidget(self.specGgraphFreq, xi, 2, 1, 2) |
|
340 | 340 | |
|
341 | 341 | self.label_16 = QtGui.QLabel(self.tabgraphSpectra) |
|
342 | 342 | self.label_16.setObjectName(_fromUtf8("label_16")) |
|
343 | 343 | self.gridLayout_9.addWidget(self.label_16, xi+1, 0, 1, 1) |
|
344 | 344 | self.specGgraphHeight = QtGui.QLineEdit(self.tabgraphSpectra) |
|
345 | 345 | self.specGgraphHeight.setObjectName(_fromUtf8("specGgraphHeight")) |
|
346 | 346 | self.gridLayout_9.addWidget(self.specGgraphHeight, xi+1, 2, 1, 2) |
|
347 | 347 | |
|
348 | 348 | self.label_17 = QtGui.QLabel(self.tabgraphSpectra) |
|
349 | 349 | self.label_17.setObjectName(_fromUtf8("label_17")) |
|
350 | 350 | self.gridLayout_9.addWidget(self.label_17, xi+2, 0, 1, 1) |
|
351 | 351 | self.specGgraphDbsrange = QtGui.QLineEdit(self.tabgraphSpectra) |
|
352 | 352 | self.specGgraphDbsrange.setObjectName(_fromUtf8("specGgraphDbsrange")) |
|
353 | 353 | self.gridLayout_9.addWidget(self.specGgraphDbsrange, xi+2, 2, 1, 2) |
|
354 | 354 | |
|
355 | 355 | self.specGraphTminTmaxLabel = QtGui.QLabel(self.tabgraphSpectra) |
|
356 | 356 | self.specGraphTminTmaxLabel.setObjectName(_fromUtf8("specGraphTminTmaxLabel")) |
|
357 | 357 | self.gridLayout_9.addWidget(self.specGraphTminTmaxLabel, xi+3, 0, 1, 2) |
|
358 | 358 | self.specGgraphTminTmax = QtGui.QLineEdit(self.tabgraphSpectra) |
|
359 | 359 | self.specGgraphTminTmax.setObjectName(_fromUtf8("specGgraphTminTmax")) |
|
360 | 360 | self.gridLayout_9.addWidget(self.specGgraphTminTmax, xi+3, 2, 1, 2) |
|
361 | 361 | |
|
362 | self.label_48 = QtGui.QLabel(self.tabgraphSpectra) | |
|
363 | self.label_48.setObjectName(_fromUtf8("label_48")) | |
|
364 | self.gridLayout_9.addWidget(self.label_48, xi+4, 0, 1, 2) | |
|
365 | self.specGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
366 | self.specGgraphTimeRange.setObjectName(_fromUtf8("specGgraphTimeRange")) | |
|
367 | self.gridLayout_9.addWidget(self.specGgraphTimeRange, xi+4, 2, 1, 2) | |
|
368 | ||
|
362 | 369 | self.specGraphMagLabel = QtGui.QLabel(self.tabgraphSpectra) |
|
363 | 370 | self.specGraphMagLabel.setObjectName(_fromUtf8("specGraphMagLabel")) |
|
364 | 371 | self.gridLayout_9.addWidget(self.specGraphMagLabel, xi, 4, 1, 2) |
|
365 | 372 | self.specGgraphmagnitud = QtGui.QLineEdit(self.tabgraphSpectra) |
|
366 | 373 | self.specGgraphmagnitud.setObjectName(_fromUtf8("specGgraphmagnitud")) |
|
367 | 374 | self.gridLayout_9.addWidget(self.specGgraphmagnitud, xi, 6, 1, 2) |
|
368 | 375 | |
|
369 | 376 | self.specGraphPhaseLabel = QtGui.QLabel(self.tabgraphSpectra) |
|
370 | 377 | self.specGraphPhaseLabel.setObjectName(_fromUtf8("specGraphPhaseLabel")) |
|
371 | 378 | self.gridLayout_9.addWidget(self.specGraphPhaseLabel, xi+1, 4, 1, 2) |
|
372 | 379 | self.specGgraphPhase = QtGui.QLineEdit(self.tabgraphSpectra) |
|
373 | 380 | self.specGgraphPhase.setObjectName(_fromUtf8("specGgraphPhase")) |
|
374 | 381 | self.gridLayout_9.addWidget(self.specGgraphPhase, xi+1, 6, 1, 2) |
|
375 | 382 | |
|
376 | 383 | self.label_6 = QtGui.QLabel(self.tabgraphSpectra) |
|
377 | 384 | self.label_6.setObjectName(_fromUtf8("label_6")) |
|
378 | 385 | self.gridLayout_9.addWidget(self.label_6, xi+2, 4, 1, 1) |
|
379 | 386 | self.specGgraphChannelList = QtGui.QLineEdit(self.tabgraphSpectra) |
|
380 | 387 | self.specGgraphChannelList.setObjectName(_fromUtf8("specGgraphChannelList")) |
|
381 | 388 | self.gridLayout_9.addWidget(self.specGgraphChannelList, xi+2, 6, 1, 2) |
|
382 | 389 | |
|
383 | 390 | self.label_29 = QtGui.QLabel(self.tabgraphSpectra) |
|
384 | 391 | self.label_29.setObjectName(_fromUtf8("label_29")) |
|
385 | 392 | self.gridLayout_9.addWidget(self.label_29, xi+3, 4, 1, 2) |
|
386 | 393 | self.specGgraphftpratio = QtGui.QLineEdit(self.tabgraphSpectra) |
|
387 | 394 | self.specGgraphftpratio.setObjectName(_fromUtf8("specGgraphftpratio")) |
|
388 | 395 | self.gridLayout_9.addWidget(self.specGgraphftpratio, xi+3, 6, 1, 2) |
|
389 | ||
|
390 | self.label_48 = QtGui.QLabel(self.tabgraphSpectra) | |
|
391 | self.label_48.setObjectName(_fromUtf8("label_48")) | |
|
392 | self.gridLayout_9.addWidget(self.label_48, xi+4, 4, 1, 2) | |
|
393 | self.specGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectra) | |
|
394 | self.specGgraphTimeRange.setObjectName(_fromUtf8("specGgraphTimeRange")) | |
|
395 | self.gridLayout_9.addWidget(self.specGgraphTimeRange, xi+4, 6, 1, 2) | |
|
396 | 396 | |
|
397 | 397 | # spacerItem15 = QtGui.QSpacerItem(28, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
398 | 398 | # self.gridLayout_9.addItem(spacerItem15, 27, 6, 1, 2) |
|
399 | 399 | # spacerItem16 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
400 | 400 | # self.gridLayout_9.addItem(spacerItem16, 3, 5, 1, 1) |
|
401 | 401 | # spacerItem17 = QtGui.QSpacerItem(49, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
402 | 402 | # self.gridLayout_9.addItem(spacerItem17, 27, 0, 1, 1) |
|
403 | 403 | |
|
404 | 404 | |
|
405 | 405 | |
|
406 | 406 | self.tabWidgetSpectra.addTab(self.tabgraphSpectra, _fromUtf8("")) |
|
407 | 407 | self.taboutputSpectra = QtGui.QWidget() |
|
408 | 408 | self.taboutputSpectra.setObjectName(_fromUtf8("taboutputSpectra")) |
|
409 | 409 | self.gridLayout_11 = QtGui.QGridLayout(self.taboutputSpectra) |
|
410 | 410 | self.gridLayout_11.setObjectName(_fromUtf8("gridLayout_11")) |
|
411 | 411 | self.label_39 = QtGui.QLabel(self.taboutputSpectra) |
|
412 | 412 | self.label_39.setObjectName(_fromUtf8("label_39")) |
|
413 | 413 | self.gridLayout_11.addWidget(self.label_39, 0, 0, 1, 1) |
|
414 | 414 | self.specOutputComData = QtGui.QComboBox(self.taboutputSpectra) |
|
415 | 415 | self.specOutputComData.setObjectName(_fromUtf8("specOutputComData")) |
|
416 | 416 | self.specOutputComData.addItem(_fromUtf8("")) |
|
417 | 417 | self.gridLayout_11.addWidget(self.specOutputComData, 0, 2, 1, 2) |
|
418 | 418 | self.label_34 = QtGui.QLabel(self.taboutputSpectra) |
|
419 | 419 | self.label_34.setObjectName(_fromUtf8("label_34")) |
|
420 | 420 | self.gridLayout_11.addWidget(self.label_34, 1, 0, 1, 1) |
|
421 | 421 | self.specOutputPath = QtGui.QLineEdit(self.taboutputSpectra) |
|
422 | 422 | self.specOutputPath.setObjectName(_fromUtf8("specOutputPath")) |
|
423 | 423 | self.gridLayout_11.addWidget(self.specOutputPath, 1, 2, 1, 1) |
|
424 | 424 | spacerItem20 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
425 | 425 | self.gridLayout_11.addItem(spacerItem20, 4, 2, 1, 1) |
|
426 | 426 | self.specOutputToolPath = QtGui.QToolButton(self.taboutputSpectra) |
|
427 | 427 | self.specOutputToolPath.setObjectName(_fromUtf8("specOutputToolPath")) |
|
428 | 428 | self.gridLayout_11.addWidget(self.specOutputToolPath, 1, 3, 1, 1) |
|
429 | 429 | self.specOutputblocksperfile = QtGui.QLineEdit(self.taboutputSpectra) |
|
430 | 430 | self.specOutputblocksperfile.setObjectName(_fromUtf8("specOutputblocksperfile")) |
|
431 | 431 | self.gridLayout_11.addWidget(self.specOutputblocksperfile, 2, 2, 1, 1) |
|
432 | 432 | self.label_9 = QtGui.QLabel(self.taboutputSpectra) |
|
433 | 433 | self.label_9.setObjectName(_fromUtf8("label_9")) |
|
434 | 434 | self.gridLayout_11.addWidget(self.label_9, 2, 0, 1, 2) |
|
435 | 435 | |
|
436 | 436 | self.tabWidgetSpectra.addTab(self.taboutputSpectra, _fromUtf8("")) |
|
437 | 437 | self.gridLayout_7.addWidget(self.tabWidgetSpectra, 0, 1, 1, 1) |
|
438 | 438 | |
|
439 | 439 | self.tabWidgetProject.addTab(self.tabSpectra, _fromUtf8("")) |
|
440 | 440 | |
|
441 | 441 | self.tabWidgetSpectra.setCurrentIndex(0) |
|
442 | 442 | |
|
443 | 443 | def retranslateUi(self): |
|
444 | 444 | |
|
445 | 445 | self.specOpOk.setText(_translate("MainWindow", "Ok", None)) |
|
446 | 446 | self.specGraphClear.setText(_translate("MainWindow", "Clear", None)) |
|
447 | 447 | self.specOpCebCrossSpectra.setText(_translate("MainWindow", "Select Cross Spectra:", None)) |
|
448 | 448 | self.specOpComChannel.setItemText(0, _translate("MainWindow", "Value", None)) |
|
449 | 449 | self.specOpComChannel.setItemText(1, _translate("MainWindow", "Index", None)) |
|
450 | 450 | self.specOpComHeights.setItemText(0, _translate("MainWindow", "Value", None)) |
|
451 | 451 | self.specOpComHeights.setItemText(1, _translate("MainWindow", "Index", None)) |
|
452 | 452 | self.specOpCebRemoveDC.setText(_translate("MainWindow", "Remove DC:", None)) |
|
453 | 453 | self.specOpCebHeights.setText(_translate("MainWindow", "Select Heights:", None)) |
|
454 | 454 | self.specOpCebChannel.setText(_translate("MainWindow", "Select Channel:", None)) |
|
455 | 455 | |
|
456 | 456 | self.specOpComCrossSpectra.setItemText(0, _translate("MainWindow", "x-y pairs", None)) |
|
457 | 457 | |
|
458 | 458 | self.specLabnFFTPoints.setText(_translate("MainWindow", "Number of FFT points:", None)) |
|
459 | 459 | self.specOpCebIncoherent.setText(_translate("MainWindow", "Incoherent Integration:", None)) |
|
460 | 460 | self.specOpCobIncInt.setItemText(0, _translate("MainWindow", "Time Interval", None)) |
|
461 | 461 | self.specOpCobIncInt.setItemText(1, _translate("MainWindow", "Number of Profiles", None)) |
|
462 | 462 | self.specOpCebRadarfrequency.setText(_translate("MainWindow", "Radar frequency (MHz):", None)) |
|
463 | 463 | self.specLabProfiles.setText(_translate("MainWindow", "Number of Profiles", None)) |
|
464 | 464 | self.specOpCebRemoveInt.setText(_translate("MainWindow", "Remove Interference:", None)) |
|
465 | 465 | self.specLabippFactor.setText(_translate("MainWindow", "Ipp Factor:", None)) |
|
466 | 466 | self.specOpCebgetNoise.setText(_translate("MainWindow", "Set Noise area:", None)) |
|
467 | 467 | self.specOpComRemoveDC.setItemText(0, _translate("MainWindow", "Mode 1", None)) |
|
468 | 468 | self.specOpComRemoveDC.setItemText(1, _translate("MainWindow", "Mode 2", None)) |
|
469 | 469 | self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.tabopSpectra), _translate("MainWindow", "Operation", None)) |
|
470 | 470 | |
|
471 | 471 | self.label_44.setText(_translate("MainWindow", "Coherence Map:", None)) |
|
472 | self.specGraphTminTmaxLabel.setText(_translate("MainWindow", "Time range:", None)) | |
|
472 | self.specGraphTminTmaxLabel.setText(_translate("MainWindow", "Time range (hours):", None)) | |
|
473 | 473 | self.label_25.setText(_translate("MainWindow", "Prefix:", None)) |
|
474 | 474 | self.label_42.setText(_translate("MainWindow", "RTI Plot:", None)) |
|
475 | 475 | self.label_16.setText(_translate("MainWindow", "Height range:", None)) |
|
476 | 476 | self.label_17.setText(_translate("MainWindow", "dB range:", None)) |
|
477 | 477 | self.specGraphMagLabel.setText(_translate("MainWindow", "Coh. Magnitud:", None)) |
|
478 | 478 | self.label_24.setText(_translate("MainWindow", "Path:", None)) |
|
479 | 479 | self.label_46.setText(_translate("MainWindow", "Power Profile:", None)) |
|
480 | 480 | self.label_22.setText(_translate("MainWindow", "Freq/Vel range:", None)) |
|
481 | 481 | self.label_41.setText(_translate("MainWindow", "Cross Spectra Plot:", None)) |
|
482 | 482 | self.specGraphToolPath.setText(_translate("MainWindow", "...", None)) |
|
483 | 483 | self.label_6.setText(_translate("MainWindow", "Channel List:", None)) |
|
484 | 484 | self.label_40.setText(_translate("MainWindow", "Spectra Plot:", None)) |
|
485 | 485 | self.label_43.setText(_translate("MainWindow", "Show:", None)) |
|
486 | 486 | self.label_29.setText(_translate("MainWindow", "Writing Period:", None)) |
|
487 | 487 | self.label_47.setText(_translate("MainWindow", "Save:", None)) |
|
488 | 488 | self.label_19.setText(_translate("MainWindow", "Ftp:", None)) |
|
489 | 489 | self.label_45.setText(_translate("MainWindow", "Noise:", None)) |
|
490 |
self.label_48.setText(_translate("MainWindow", "Time |
|
|
490 | self.label_48.setText(_translate("MainWindow", "Time window (seconds):", None)) | |
|
491 | 491 | self.specGraphPhaseLabel.setText(_translate("MainWindow", "Coh. Phase:", None)) |
|
492 | self.label_48.hide() | |
|
493 | self.specGgraphTimeRange.hide() | |
|
492 | # self.label_48.hide() | |
|
493 | # self.specGgraphTimeRange.hide() | |
|
494 | 494 | self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.tabgraphSpectra), _translate("MainWindow", "Graphics", None)) |
|
495 | 495 | |
|
496 | 496 | self.label_39.setText(_translate("MainWindow", "Type:", None)) |
|
497 | 497 | self.specOutputComData.setItemText(0, _translate("MainWindow", ".pdata", None)) |
|
498 | 498 | self.label_34.setText(_translate("MainWindow", "Path:", None)) |
|
499 | 499 | self.specOutputToolPath.setText(_translate("MainWindow", "...", None)) |
|
500 | 500 | self.label_9.setText(_translate("MainWindow", "Blocks per File: ", None)) |
|
501 | 501 | |
|
502 | 502 | self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.taboutputSpectra), _translate("MainWindow", "Output", None)) |
|
503 | 503 | |
|
504 | 504 | self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectra), _translate("MainWindow", "Spectra", None)) |
|
505 | 505 | |
|
506 | 506 | self.__setToolTip() |
|
507 | 507 | |
|
508 | 508 | def __setToolTip(self): |
|
509 | 509 | |
|
510 | 510 | self.specOpnFFTpoints.setToolTip('Number of FFT points used in FFT function. Example: 128') |
|
511 | 511 | self.specOpProfiles.setToolTip('Number of data points used in FFT function. Example: 128') |
|
512 | 512 | self.specOpippFactor.setToolTip('This factor is multiplied to IPP value to get velocity and frequency range. Example: 4') |
|
513 | 513 | self.specOpIncoherent.setToolTip('Example: 10') |
|
514 | 514 | self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') |
|
515 | 515 | |
|
516 | 516 | self.specOpChannel.setToolTip('Example: 0,1,2,3') |
|
517 | 517 | self.specOpHeights.setToolTip('Example: 90,180') |
|
518 | 518 | self.specOppairsList.setToolTip('Example: (0,1),(2,3)') |
|
519 | 519 | # tool tip gui specGraph |
|
520 | 520 | |
|
521 | 521 | self.specGgraphChannelList.setToolTip('Example: 0,3,4') |
|
522 | 522 | self.specGgraphFreq.setToolTip('Example: -20,20') |
|
523 | 523 | self.specGgraphHeight.setToolTip('Example: 100,400') |
|
524 | 524 | self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
525 | 525 | |
|
526 | 526 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
527 | 527 | |
|
528 | 528 | No newline at end of file |
@@ -1,1509 +1,1509 | |||
|
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, isTimeInHourRange |
|
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 = 250 |
|
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 | xaxis="velocity"): |
|
90 | 90 | |
|
91 | 91 | """ |
|
92 | 92 | |
|
93 | 93 | Input: |
|
94 | 94 | dataOut : |
|
95 | 95 | id : |
|
96 | 96 | wintitle : |
|
97 | 97 | channelList : |
|
98 | 98 | showProfile : |
|
99 | 99 | xmin : None, |
|
100 | 100 | xmax : None, |
|
101 | 101 | ymin : None, |
|
102 | 102 | ymax : None, |
|
103 | 103 | zmin : None, |
|
104 | 104 | zmax : None |
|
105 | 105 | """ |
|
106 | 106 | |
|
107 | 107 | if realtime: |
|
108 | 108 | if not(isRealtime(utcdatatime = dataOut.utctime)): |
|
109 | 109 | print 'Skipping this plot function' |
|
110 | 110 | return |
|
111 | 111 | |
|
112 | 112 | if channelList == None: |
|
113 | 113 | channelIndexList = dataOut.channelIndexList |
|
114 | 114 | else: |
|
115 | 115 | channelIndexList = [] |
|
116 | 116 | for channel in channelList: |
|
117 | 117 | if channel not in dataOut.channelList: |
|
118 | 118 | raise ValueError, "Channel %d is not in dataOut.channelList" %channel |
|
119 | 119 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
120 | 120 | |
|
121 | 121 | factor = dataOut.normFactor |
|
122 | 122 | |
|
123 | 123 | if xaxis == "frequency": |
|
124 | 124 | x = dataOut.getFreqRange(1)/1000. |
|
125 | 125 | xlabel = "Frquency (kHz)" |
|
126 | 126 | |
|
127 | 127 | elif xaxis == "time": |
|
128 | 128 | x = dataOut.getAcfRange(1) |
|
129 | 129 | xlabel = "Time (ms)" |
|
130 | 130 | |
|
131 | 131 | else: |
|
132 | 132 | x = dataOut.getVelRange(1) |
|
133 | 133 | xlabel = "Velocity (m/s)" |
|
134 | 134 | |
|
135 | 135 | ylabel = "Range (Km)" |
|
136 | 136 | |
|
137 | 137 | y = dataOut.getHeiRange() |
|
138 | 138 | |
|
139 | 139 | z = dataOut.data_spc/factor |
|
140 | 140 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
141 | 141 | zdB = 10*numpy.log10(z) |
|
142 | 142 | |
|
143 | 143 | avg = numpy.average(z, axis=1) |
|
144 | 144 | avgdB = 10*numpy.log10(avg) |
|
145 | 145 | |
|
146 | 146 | noise = dataOut.getNoise()/factor |
|
147 | 147 | noisedB = 10*numpy.log10(noise) |
|
148 | 148 | |
|
149 | 149 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
150 | 150 | title = wintitle + " Spectra" |
|
151 | 151 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
152 | 152 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
153 | 153 | |
|
154 | 154 | if not self.isConfig: |
|
155 | 155 | |
|
156 | 156 | nplots = len(channelIndexList) |
|
157 | 157 | |
|
158 | 158 | self.setup(id=id, |
|
159 | 159 | nplots=nplots, |
|
160 | 160 | wintitle=wintitle, |
|
161 | 161 | showprofile=showprofile, |
|
162 | 162 | show=show) |
|
163 | 163 | |
|
164 | 164 | if xmin == None: xmin = numpy.nanmin(x) |
|
165 | 165 | if xmax == None: xmax = numpy.nanmax(x) |
|
166 | 166 | if ymin == None: ymin = numpy.nanmin(y) |
|
167 | 167 | if ymax == None: ymax = numpy.nanmax(y) |
|
168 | 168 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
169 | 169 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
170 | 170 | |
|
171 | 171 | self.FTP_WEI = ftp_wei |
|
172 | 172 | self.EXP_CODE = exp_code |
|
173 | 173 | self.SUB_EXP_CODE = sub_exp_code |
|
174 | 174 | self.PLOT_POS = plot_pos |
|
175 | 175 | |
|
176 | 176 | self.isConfig = True |
|
177 | 177 | |
|
178 | 178 | self.setWinTitle(title) |
|
179 | 179 | |
|
180 | 180 | for i in range(self.nplots): |
|
181 | 181 | index = channelIndexList[i] |
|
182 | 182 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
183 | 183 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[index], noisedB[index], str_datetime) |
|
184 | 184 | if len(dataOut.beam.codeList) != 0: |
|
185 | 185 | title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[index], noisedB[index], dataOut.beam.azimuthList[index], dataOut.beam.zenithList[index], str_datetime) |
|
186 | 186 | |
|
187 | 187 | axes = self.axesList[i*self.__nsubplots] |
|
188 | 188 | axes.pcolor(x, y, zdB[index,:,:], |
|
189 | 189 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
190 | 190 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
191 | 191 | ticksize=9, cblabel='') |
|
192 | 192 | |
|
193 | 193 | if self.__showprofile: |
|
194 | 194 | axes = self.axesList[i*self.__nsubplots +1] |
|
195 | 195 | axes.pline(avgdB[index,:], y, |
|
196 | 196 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
197 | 197 | xlabel='dB', ylabel='', title='', |
|
198 | 198 | ytick_visible=False, |
|
199 | 199 | grid='x') |
|
200 | 200 | |
|
201 | 201 | noiseline = numpy.repeat(noisedB[index], len(y)) |
|
202 | 202 | axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2) |
|
203 | 203 | |
|
204 | 204 | self.draw() |
|
205 | 205 | |
|
206 | 206 | if figfile == None: |
|
207 | 207 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
208 | 208 | name = str_datetime |
|
209 | 209 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
210 | 210 | name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) |
|
211 | 211 | figfile = self.getFilename(name) |
|
212 | 212 | |
|
213 | 213 | self.save(figpath=figpath, |
|
214 | 214 | figfile=figfile, |
|
215 | 215 | save=save, |
|
216 | 216 | ftp=ftp, |
|
217 | 217 | wr_period=wr_period, |
|
218 | 218 | thisDatetime=thisDatetime) |
|
219 | 219 | |
|
220 | 220 | class CrossSpectraPlot(Figure): |
|
221 | 221 | |
|
222 | 222 | isConfig = None |
|
223 | 223 | __nsubplots = None |
|
224 | 224 | |
|
225 | 225 | WIDTH = None |
|
226 | 226 | HEIGHT = None |
|
227 | 227 | WIDTHPROF = None |
|
228 | 228 | HEIGHTPROF = None |
|
229 | 229 | PREFIX = 'cspc' |
|
230 | 230 | |
|
231 | 231 | def __init__(self): |
|
232 | 232 | |
|
233 | 233 | self.isConfig = False |
|
234 | 234 | self.__nsubplots = 4 |
|
235 | 235 | self.counter_imagwr = 0 |
|
236 | 236 | self.WIDTH = 250 |
|
237 | 237 | self.HEIGHT = 250 |
|
238 | 238 | self.WIDTHPROF = 0 |
|
239 | 239 | self.HEIGHTPROF = 0 |
|
240 | 240 | |
|
241 | 241 | self.PLOT_CODE = CROSS_CODE |
|
242 | 242 | self.FTP_WEI = None |
|
243 | 243 | self.EXP_CODE = None |
|
244 | 244 | self.SUB_EXP_CODE = None |
|
245 | 245 | self.PLOT_POS = None |
|
246 | 246 | |
|
247 | 247 | def getSubplots(self): |
|
248 | 248 | |
|
249 | 249 | ncol = 4 |
|
250 | 250 | nrow = self.nplots |
|
251 | 251 | |
|
252 | 252 | return nrow, ncol |
|
253 | 253 | |
|
254 | 254 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
255 | 255 | |
|
256 | 256 | self.__showprofile = showprofile |
|
257 | 257 | self.nplots = nplots |
|
258 | 258 | |
|
259 | 259 | ncolspan = 1 |
|
260 | 260 | colspan = 1 |
|
261 | 261 | |
|
262 | 262 | self.createFigure(id = id, |
|
263 | 263 | wintitle = wintitle, |
|
264 | 264 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
265 | 265 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
266 | 266 | show=True) |
|
267 | 267 | |
|
268 | 268 | nrow, ncol = self.getSubplots() |
|
269 | 269 | |
|
270 | 270 | counter = 0 |
|
271 | 271 | for y in range(nrow): |
|
272 | 272 | for x in range(ncol): |
|
273 | 273 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
274 | 274 | |
|
275 | 275 | counter += 1 |
|
276 | 276 | |
|
277 | 277 | def run(self, dataOut, id, wintitle="", pairsList=None, |
|
278 | 278 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
279 | 279 | coh_min=None, coh_max=None, phase_min=None, phase_max=None, |
|
280 | 280 | save=False, figpath='./', figfile=None, ftp=False, wr_period=1, |
|
281 | 281 | power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True, |
|
282 | 282 | server=None, folder=None, username=None, password=None, |
|
283 | 283 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
284 | 284 | |
|
285 | 285 | """ |
|
286 | 286 | |
|
287 | 287 | Input: |
|
288 | 288 | dataOut : |
|
289 | 289 | id : |
|
290 | 290 | wintitle : |
|
291 | 291 | channelList : |
|
292 | 292 | showProfile : |
|
293 | 293 | xmin : None, |
|
294 | 294 | xmax : None, |
|
295 | 295 | ymin : None, |
|
296 | 296 | ymax : None, |
|
297 | 297 | zmin : None, |
|
298 | 298 | zmax : None |
|
299 | 299 | """ |
|
300 | 300 | |
|
301 | 301 | if pairsList == None: |
|
302 | 302 | pairsIndexList = dataOut.pairsIndexList |
|
303 | 303 | else: |
|
304 | 304 | pairsIndexList = [] |
|
305 | 305 | for pair in pairsList: |
|
306 | 306 | if pair not in dataOut.pairsList: |
|
307 | 307 | raise ValueError, "Pair %s is not in dataOut.pairsList" %str(pair) |
|
308 | 308 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
309 | 309 | |
|
310 | 310 | if not pairsIndexList: |
|
311 | 311 | return |
|
312 | 312 | |
|
313 | 313 | if len(pairsIndexList) > 4: |
|
314 | 314 | pairsIndexList = pairsIndexList[0:4] |
|
315 | 315 | |
|
316 | 316 | factor = dataOut.normFactor |
|
317 | 317 | x = dataOut.getVelRange(1) |
|
318 | 318 | y = dataOut.getHeiRange() |
|
319 | 319 | z = dataOut.data_spc[:,:,:]/factor |
|
320 | 320 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
321 | 321 | |
|
322 | 322 | noise = dataOut.noise/factor |
|
323 | 323 | |
|
324 | 324 | zdB = 10*numpy.log10(z) |
|
325 | 325 | noisedB = 10*numpy.log10(noise) |
|
326 | 326 | |
|
327 | 327 | if coh_min == None: |
|
328 | 328 | coh_min = 0.0 |
|
329 | 329 | if coh_max == None: |
|
330 | 330 | coh_max = 1.0 |
|
331 | 331 | |
|
332 | 332 | if phase_min == None: |
|
333 | 333 | phase_min = -180 |
|
334 | 334 | if phase_max == None: |
|
335 | 335 | phase_max = 180 |
|
336 | 336 | |
|
337 | 337 | #thisDatetime = dataOut.datatime |
|
338 | 338 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
339 | 339 | title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
340 | 340 | xlabel = "Velocity (m/s)" |
|
341 | 341 | ylabel = "Range (Km)" |
|
342 | 342 | |
|
343 | 343 | if not self.isConfig: |
|
344 | 344 | |
|
345 | 345 | nplots = len(pairsIndexList) |
|
346 | 346 | |
|
347 | 347 | self.setup(id=id, |
|
348 | 348 | nplots=nplots, |
|
349 | 349 | wintitle=wintitle, |
|
350 | 350 | showprofile=False, |
|
351 | 351 | show=show) |
|
352 | 352 | |
|
353 | 353 | avg = numpy.abs(numpy.average(z, axis=1)) |
|
354 | 354 | avgdB = 10*numpy.log10(avg) |
|
355 | 355 | |
|
356 | 356 | if xmin == None: xmin = numpy.nanmin(x) |
|
357 | 357 | if xmax == None: xmax = numpy.nanmax(x) |
|
358 | 358 | if ymin == None: ymin = numpy.nanmin(y) |
|
359 | 359 | if ymax == None: ymax = numpy.nanmax(y) |
|
360 | 360 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
361 | 361 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
362 | 362 | |
|
363 | 363 | self.FTP_WEI = ftp_wei |
|
364 | 364 | self.EXP_CODE = exp_code |
|
365 | 365 | self.SUB_EXP_CODE = sub_exp_code |
|
366 | 366 | self.PLOT_POS = plot_pos |
|
367 | 367 | |
|
368 | 368 | self.isConfig = True |
|
369 | 369 | |
|
370 | 370 | self.setWinTitle(title) |
|
371 | 371 | |
|
372 | 372 | for i in range(self.nplots): |
|
373 | 373 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
374 | 374 | |
|
375 | 375 | chan_index0 = dataOut.channelList.index(pair[0]) |
|
376 | 376 | chan_index1 = dataOut.channelList.index(pair[1]) |
|
377 | 377 | |
|
378 | 378 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
379 | 379 | title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[chan_index0], str_datetime) |
|
380 | 380 | zdB = 10.*numpy.log10(dataOut.data_spc[chan_index0,:,:]/factor) |
|
381 | 381 | axes0 = self.axesList[i*self.__nsubplots] |
|
382 | 382 | axes0.pcolor(x, y, zdB, |
|
383 | 383 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
384 | 384 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
385 | 385 | ticksize=9, colormap=power_cmap, cblabel='') |
|
386 | 386 | |
|
387 | 387 | title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[chan_index1], str_datetime) |
|
388 | 388 | zdB = 10.*numpy.log10(dataOut.data_spc[chan_index1,:,:]/factor) |
|
389 | 389 | axes0 = self.axesList[i*self.__nsubplots+1] |
|
390 | 390 | axes0.pcolor(x, y, zdB, |
|
391 | 391 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
392 | 392 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
393 | 393 | ticksize=9, colormap=power_cmap, cblabel='') |
|
394 | 394 | |
|
395 | 395 | coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[chan_index0,:,:]*dataOut.data_spc[chan_index1,:,:]) |
|
396 | 396 | coherence = numpy.abs(coherenceComplex) |
|
397 | 397 | # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi |
|
398 | 398 | phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi |
|
399 | 399 | |
|
400 | 400 | title = "Coherence Ch%d * Ch%d" %(pair[0], pair[1]) |
|
401 | 401 | axes0 = self.axesList[i*self.__nsubplots+2] |
|
402 | 402 | axes0.pcolor(x, y, coherence, |
|
403 | 403 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=coh_min, zmax=coh_max, |
|
404 | 404 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
405 | 405 | ticksize=9, colormap=coherence_cmap, cblabel='') |
|
406 | 406 | |
|
407 | 407 | title = "Phase Ch%d * Ch%d" %(pair[0], pair[1]) |
|
408 | 408 | axes0 = self.axesList[i*self.__nsubplots+3] |
|
409 | 409 | axes0.pcolor(x, y, phase, |
|
410 | 410 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max, |
|
411 | 411 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
412 | 412 | ticksize=9, colormap=phase_cmap, cblabel='') |
|
413 | 413 | |
|
414 | 414 | |
|
415 | 415 | |
|
416 | 416 | self.draw() |
|
417 | 417 | |
|
418 | 418 | self.save(figpath=figpath, |
|
419 | 419 | figfile=figfile, |
|
420 | 420 | save=save, |
|
421 | 421 | ftp=ftp, |
|
422 | 422 | wr_period=wr_period, |
|
423 | 423 | thisDatetime=thisDatetime) |
|
424 | 424 | |
|
425 | 425 | |
|
426 | 426 | class RTIPlot(Figure): |
|
427 | 427 | |
|
428 | 428 | __isConfig = None |
|
429 | 429 | __nsubplots = None |
|
430 | 430 | |
|
431 | 431 | WIDTHPROF = None |
|
432 | 432 | HEIGHTPROF = None |
|
433 | 433 | PREFIX = 'rti' |
|
434 | 434 | |
|
435 | 435 | def __init__(self): |
|
436 | 436 | |
|
437 | 437 | self.timerange = None |
|
438 | 438 | self.isConfig = False |
|
439 | 439 | self.__nsubplots = 1 |
|
440 | 440 | |
|
441 | 441 | self.WIDTH = 800 |
|
442 | 442 | self.HEIGHT = 180 |
|
443 | 443 | self.WIDTHPROF = 120 |
|
444 | 444 | self.HEIGHTPROF = 0 |
|
445 | 445 | self.counter_imagwr = 0 |
|
446 | 446 | |
|
447 | 447 | self.PLOT_CODE = RTI_CODE |
|
448 | 448 | |
|
449 | 449 | self.FTP_WEI = None |
|
450 | 450 | self.EXP_CODE = None |
|
451 | 451 | self.SUB_EXP_CODE = None |
|
452 | 452 | self.PLOT_POS = None |
|
453 | 453 | self.tmin = None |
|
454 | 454 | self.tmax = None |
|
455 | 455 | |
|
456 | 456 | self.xmin = None |
|
457 | 457 | self.xmax = None |
|
458 | 458 | |
|
459 | 459 | self.figfile = None |
|
460 | 460 | |
|
461 | 461 | def getSubplots(self): |
|
462 | 462 | |
|
463 | 463 | ncol = 1 |
|
464 | 464 | nrow = self.nplots |
|
465 | 465 | |
|
466 | 466 | return nrow, ncol |
|
467 | 467 | |
|
468 | 468 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
469 | 469 | |
|
470 | 470 | self.__showprofile = showprofile |
|
471 | 471 | self.nplots = nplots |
|
472 | 472 | |
|
473 | 473 | ncolspan = 1 |
|
474 | 474 | colspan = 1 |
|
475 | 475 | if showprofile: |
|
476 | 476 | ncolspan = 7 |
|
477 | 477 | colspan = 6 |
|
478 | 478 | self.__nsubplots = 2 |
|
479 | 479 | |
|
480 | 480 | self.createFigure(id = id, |
|
481 | 481 | wintitle = wintitle, |
|
482 | 482 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
483 | 483 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
484 | 484 | show=show) |
|
485 | 485 | |
|
486 | 486 | nrow, ncol = self.getSubplots() |
|
487 | 487 | |
|
488 | 488 | counter = 0 |
|
489 | 489 | for y in range(nrow): |
|
490 | 490 | for x in range(ncol): |
|
491 | 491 | |
|
492 | 492 | if counter >= self.nplots: |
|
493 | 493 | break |
|
494 | 494 | |
|
495 | 495 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
496 | 496 | |
|
497 | 497 | if showprofile: |
|
498 | 498 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
499 | 499 | |
|
500 | 500 | counter += 1 |
|
501 | 501 | |
|
502 | 502 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True', |
|
503 | 503 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
504 | 504 | timerange=None, |
|
505 | 505 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
506 | 506 | server=None, folder=None, username=None, password=None, |
|
507 | 507 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
508 | 508 | |
|
509 | 509 | """ |
|
510 | 510 | |
|
511 | 511 | Input: |
|
512 | 512 | dataOut : |
|
513 | 513 | id : |
|
514 | 514 | wintitle : |
|
515 | 515 | channelList : |
|
516 | 516 | showProfile : |
|
517 | 517 | xmin : None, |
|
518 | 518 | xmax : None, |
|
519 | 519 | ymin : None, |
|
520 | 520 | ymax : None, |
|
521 | 521 | zmin : None, |
|
522 | 522 | zmax : None |
|
523 | 523 | """ |
|
524 | 524 | |
|
525 | 525 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
526 | 526 | return |
|
527 | 527 | |
|
528 | 528 | if channelList == None: |
|
529 | 529 | channelIndexList = dataOut.channelIndexList |
|
530 | 530 | else: |
|
531 | 531 | channelIndexList = [] |
|
532 | 532 | for channel in channelList: |
|
533 | 533 | if channel not in dataOut.channelList: |
|
534 | 534 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
535 | 535 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
536 | 536 | |
|
537 | 537 | factor = dataOut.normFactor |
|
538 | 538 | x = dataOut.getTimeRange() |
|
539 | 539 | y = dataOut.getHeiRange() |
|
540 | 540 | |
|
541 | 541 | z = dataOut.data_spc/factor |
|
542 | 542 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
543 | 543 | avg = numpy.average(z, axis=1) |
|
544 | 544 | |
|
545 | 545 | avgdB = 10.*numpy.log10(avg) |
|
546 | 546 | |
|
547 | 547 | thisDatetime = dataOut.datatime |
|
548 | 548 | # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
549 | 549 | title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
550 | 550 | xlabel = "" |
|
551 | 551 | ylabel = "Range (Km)" |
|
552 | 552 | |
|
553 | 553 | update_figfile = False |
|
554 | 554 | |
|
555 | if dataOut.ltctime >= self.xmax: | |
|
556 | self.counter_imagwr = wr_period | |
|
557 | self.isConfig = False | |
|
558 | update_figfile = True | |
|
559 | ||
|
555 | 560 | if not self.isConfig: |
|
556 | 561 | |
|
557 | 562 | nplots = len(channelIndexList) |
|
558 | 563 | |
|
559 | 564 | self.setup(id=id, |
|
560 | 565 | nplots=nplots, |
|
561 | 566 | wintitle=wintitle, |
|
562 | 567 | showprofile=showprofile, |
|
563 | 568 | show=show) |
|
564 | 569 | |
|
565 | 570 | if timerange != None: |
|
566 | 571 | self.timerange = timerange |
|
567 | 572 | |
|
568 | 573 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
569 | 574 | |
|
570 | 575 | noise = dataOut.noise/factor |
|
571 | 576 | noisedB = 10*numpy.log10(noise) |
|
572 | 577 | |
|
573 | 578 | if ymin == None: ymin = numpy.nanmin(y) |
|
574 | 579 | if ymax == None: ymax = numpy.nanmax(y) |
|
575 | 580 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
576 | 581 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
577 | 582 | |
|
578 | 583 | self.FTP_WEI = ftp_wei |
|
579 | 584 | self.EXP_CODE = exp_code |
|
580 | 585 | self.SUB_EXP_CODE = sub_exp_code |
|
581 | 586 | self.PLOT_POS = plot_pos |
|
582 | 587 | |
|
583 | 588 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
584 | 589 | self.isConfig = True |
|
585 | 590 | self.figfile = figfile |
|
586 | 591 | update_figfile = True |
|
587 | 592 | |
|
588 | 593 | self.setWinTitle(title) |
|
589 | 594 | |
|
590 | 595 | for i in range(self.nplots): |
|
591 | 596 | index = channelIndexList[i] |
|
592 | 597 | title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
593 | 598 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
594 | 599 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
595 | 600 | axes = self.axesList[i*self.__nsubplots] |
|
596 | 601 | zdB = avgdB[index].reshape((1,-1)) |
|
597 | 602 | axes.pcolorbuffer(x, y, zdB, |
|
598 | 603 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
599 | 604 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
600 | 605 | ticksize=9, cblabel='', cbsize="1%") |
|
601 | 606 | |
|
602 | 607 | if self.__showprofile: |
|
603 | 608 | axes = self.axesList[i*self.__nsubplots +1] |
|
604 | 609 | axes.pline(avgdB[index], y, |
|
605 | 610 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
606 | 611 | xlabel='dB', ylabel='', title='', |
|
607 | 612 | ytick_visible=False, |
|
608 | 613 | grid='x') |
|
609 | 614 | |
|
610 | 615 | self.draw() |
|
611 | ||
|
612 | if dataOut.ltctime >= self.xmax: | |
|
613 | self.counter_imagwr = wr_period | |
|
614 | self.isConfig = False | |
|
615 | update_figfile = True | |
|
616 | 616 | |
|
617 | 617 | self.save(figpath=figpath, |
|
618 | 618 | figfile=figfile, |
|
619 | 619 | save=save, |
|
620 | 620 | ftp=ftp, |
|
621 | 621 | wr_period=wr_period, |
|
622 | 622 | thisDatetime=thisDatetime, |
|
623 | 623 | update_figfile=update_figfile) |
|
624 | 624 | |
|
625 | 625 | class CoherenceMap(Figure): |
|
626 | 626 | isConfig = None |
|
627 | 627 | __nsubplots = None |
|
628 | 628 | |
|
629 | 629 | WIDTHPROF = None |
|
630 | 630 | HEIGHTPROF = None |
|
631 | 631 | PREFIX = 'cmap' |
|
632 | 632 | |
|
633 | 633 | def __init__(self): |
|
634 | 634 | self.timerange = 2*60*60 |
|
635 | 635 | self.isConfig = False |
|
636 | 636 | self.__nsubplots = 1 |
|
637 | 637 | |
|
638 | 638 | self.WIDTH = 800 |
|
639 | 639 | self.HEIGHT = 180 |
|
640 | 640 | self.WIDTHPROF = 120 |
|
641 | 641 | self.HEIGHTPROF = 0 |
|
642 | 642 | self.counter_imagwr = 0 |
|
643 | 643 | |
|
644 | 644 | self.PLOT_CODE = COH_CODE |
|
645 | 645 | |
|
646 | 646 | self.FTP_WEI = None |
|
647 | 647 | self.EXP_CODE = None |
|
648 | 648 | self.SUB_EXP_CODE = None |
|
649 | 649 | self.PLOT_POS = None |
|
650 | 650 | self.counter_imagwr = 0 |
|
651 | 651 | |
|
652 | 652 | self.xmin = None |
|
653 | 653 | self.xmax = None |
|
654 | 654 | |
|
655 | 655 | def getSubplots(self): |
|
656 | 656 | ncol = 1 |
|
657 | 657 | nrow = self.nplots*2 |
|
658 | 658 | |
|
659 | 659 | return nrow, ncol |
|
660 | 660 | |
|
661 | 661 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
662 | 662 | self.__showprofile = showprofile |
|
663 | 663 | self.nplots = nplots |
|
664 | 664 | |
|
665 | 665 | ncolspan = 1 |
|
666 | 666 | colspan = 1 |
|
667 | 667 | if showprofile: |
|
668 | 668 | ncolspan = 7 |
|
669 | 669 | colspan = 6 |
|
670 | 670 | self.__nsubplots = 2 |
|
671 | 671 | |
|
672 | 672 | self.createFigure(id = id, |
|
673 | 673 | wintitle = wintitle, |
|
674 | 674 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
675 | 675 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
676 | 676 | show=True) |
|
677 | 677 | |
|
678 | 678 | nrow, ncol = self.getSubplots() |
|
679 | 679 | |
|
680 | 680 | for y in range(nrow): |
|
681 | 681 | for x in range(ncol): |
|
682 | 682 | |
|
683 | 683 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
684 | 684 | |
|
685 | 685 | if showprofile: |
|
686 | 686 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
687 | 687 | |
|
688 | 688 | def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True', |
|
689 | 689 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
690 | 690 | timerange=None, phase_min=None, phase_max=None, |
|
691 | 691 | save=False, figpath='./', figfile=None, ftp=False, wr_period=1, |
|
692 | 692 | coherence_cmap='jet', phase_cmap='RdBu_r', show=True, |
|
693 | 693 | server=None, folder=None, username=None, password=None, |
|
694 | 694 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
695 | 695 | |
|
696 | 696 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
697 | 697 | return |
|
698 | 698 | |
|
699 | 699 | if pairsList == None: |
|
700 | 700 | pairsIndexList = dataOut.pairsIndexList |
|
701 | 701 | else: |
|
702 | 702 | pairsIndexList = [] |
|
703 | 703 | for pair in pairsList: |
|
704 | 704 | if pair not in dataOut.pairsList: |
|
705 | 705 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
706 | 706 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
707 | 707 | |
|
708 | 708 | if pairsIndexList == []: |
|
709 | 709 | return |
|
710 | 710 | |
|
711 | 711 | if len(pairsIndexList) > 4: |
|
712 | 712 | pairsIndexList = pairsIndexList[0:4] |
|
713 | 713 | |
|
714 | 714 | if phase_min == None: |
|
715 | 715 | phase_min = -180 |
|
716 | 716 | if phase_max == None: |
|
717 | 717 | phase_max = 180 |
|
718 | 718 | |
|
719 | 719 | x = dataOut.getTimeRange() |
|
720 | 720 | y = dataOut.getHeiRange() |
|
721 | 721 | |
|
722 | 722 | thisDatetime = dataOut.datatime |
|
723 | 723 | |
|
724 | 724 | title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
725 | 725 | xlabel = "" |
|
726 | 726 | ylabel = "Range (Km)" |
|
727 | 727 | update_figfile = False |
|
728 | 728 | |
|
729 | 729 | if not self.isConfig: |
|
730 | 730 | nplots = len(pairsIndexList) |
|
731 | 731 | self.setup(id=id, |
|
732 | 732 | nplots=nplots, |
|
733 | 733 | wintitle=wintitle, |
|
734 | 734 | showprofile=showprofile, |
|
735 | 735 | show=show) |
|
736 | 736 | |
|
737 | 737 | if timerange != None: |
|
738 | 738 | self.timerange = timerange |
|
739 | 739 | |
|
740 | 740 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
741 | 741 | |
|
742 | 742 | if ymin == None: ymin = numpy.nanmin(y) |
|
743 | 743 | if ymax == None: ymax = numpy.nanmax(y) |
|
744 | 744 | if zmin == None: zmin = 0. |
|
745 | 745 | if zmax == None: zmax = 1. |
|
746 | 746 | |
|
747 | 747 | self.FTP_WEI = ftp_wei |
|
748 | 748 | self.EXP_CODE = exp_code |
|
749 | 749 | self.SUB_EXP_CODE = sub_exp_code |
|
750 | 750 | self.PLOT_POS = plot_pos |
|
751 | 751 | |
|
752 | 752 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
753 | 753 | |
|
754 | 754 | self.isConfig = True |
|
755 | 755 | update_figfile = True |
|
756 | 756 | |
|
757 | 757 | self.setWinTitle(title) |
|
758 | 758 | |
|
759 | 759 | for i in range(self.nplots): |
|
760 | 760 | |
|
761 | 761 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
762 | 762 | |
|
763 | 763 | ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0) |
|
764 | 764 | powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0) |
|
765 | 765 | powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0) |
|
766 | 766 | |
|
767 | 767 | |
|
768 | 768 | avgcoherenceComplex = ccf/numpy.sqrt(powa*powb) |
|
769 | 769 | coherence = numpy.abs(avgcoherenceComplex) |
|
770 | 770 | |
|
771 | 771 | z = coherence.reshape((1,-1)) |
|
772 | 772 | |
|
773 | 773 | counter = 0 |
|
774 | 774 | |
|
775 | 775 | title = "Coherence Ch%d * Ch%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
776 | 776 | axes = self.axesList[i*self.__nsubplots*2] |
|
777 | 777 | axes.pcolorbuffer(x, y, z, |
|
778 | 778 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
779 | 779 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
780 | 780 | ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%") |
|
781 | 781 | |
|
782 | 782 | if self.__showprofile: |
|
783 | 783 | counter += 1 |
|
784 | 784 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
785 | 785 | axes.pline(coherence, y, |
|
786 | 786 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
787 | 787 | xlabel='', ylabel='', title='', ticksize=7, |
|
788 | 788 | ytick_visible=False, nxticks=5, |
|
789 | 789 | grid='x') |
|
790 | 790 | |
|
791 | 791 | counter += 1 |
|
792 | 792 | |
|
793 | 793 | phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi |
|
794 | 794 | |
|
795 | 795 | z = phase.reshape((1,-1)) |
|
796 | 796 | |
|
797 | 797 | title = "Phase Ch%d * Ch%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
798 | 798 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
799 | 799 | axes.pcolorbuffer(x, y, z, |
|
800 | 800 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max, |
|
801 | 801 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
802 | 802 | ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%") |
|
803 | 803 | |
|
804 | 804 | if self.__showprofile: |
|
805 | 805 | counter += 1 |
|
806 | 806 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
807 | 807 | axes.pline(phase, y, |
|
808 | 808 | xmin=phase_min, xmax=phase_max, ymin=ymin, ymax=ymax, |
|
809 | 809 | xlabel='', ylabel='', title='', ticksize=7, |
|
810 | 810 | ytick_visible=False, nxticks=4, |
|
811 | 811 | grid='x') |
|
812 | 812 | |
|
813 | 813 | self.draw() |
|
814 | 814 | |
|
815 | 815 | if dataOut.ltctime >= self.xmax: |
|
816 | 816 | self.counter_imagwr = wr_period |
|
817 | 817 | self.isConfig = False |
|
818 | 818 | update_figfile = True |
|
819 | 819 | |
|
820 | 820 | self.save(figpath=figpath, |
|
821 | 821 | figfile=figfile, |
|
822 | 822 | save=save, |
|
823 | 823 | ftp=ftp, |
|
824 | 824 | wr_period=wr_period, |
|
825 | 825 | thisDatetime=thisDatetime, |
|
826 | 826 | update_figfile=update_figfile) |
|
827 | 827 | |
|
828 | 828 | class PowerProfilePlot(Figure): |
|
829 | 829 | |
|
830 | 830 | isConfig = None |
|
831 | 831 | __nsubplots = None |
|
832 | 832 | |
|
833 | 833 | WIDTHPROF = None |
|
834 | 834 | HEIGHTPROF = None |
|
835 | 835 | PREFIX = 'spcprofile' |
|
836 | 836 | |
|
837 | 837 | def __init__(self): |
|
838 | 838 | self.isConfig = False |
|
839 | 839 | self.__nsubplots = 1 |
|
840 | 840 | |
|
841 | 841 | self.PLOT_CODE = POWER_CODE |
|
842 | 842 | |
|
843 | 843 | self.WIDTH = 300 |
|
844 | 844 | self.HEIGHT = 500 |
|
845 | 845 | self.counter_imagwr = 0 |
|
846 | 846 | |
|
847 | 847 | def getSubplots(self): |
|
848 | 848 | ncol = 1 |
|
849 | 849 | nrow = 1 |
|
850 | 850 | |
|
851 | 851 | return nrow, ncol |
|
852 | 852 | |
|
853 | 853 | def setup(self, id, nplots, wintitle, show): |
|
854 | 854 | |
|
855 | 855 | self.nplots = nplots |
|
856 | 856 | |
|
857 | 857 | ncolspan = 1 |
|
858 | 858 | colspan = 1 |
|
859 | 859 | |
|
860 | 860 | self.createFigure(id = id, |
|
861 | 861 | wintitle = wintitle, |
|
862 | 862 | widthplot = self.WIDTH, |
|
863 | 863 | heightplot = self.HEIGHT, |
|
864 | 864 | show=show) |
|
865 | 865 | |
|
866 | 866 | nrow, ncol = self.getSubplots() |
|
867 | 867 | |
|
868 | 868 | counter = 0 |
|
869 | 869 | for y in range(nrow): |
|
870 | 870 | for x in range(ncol): |
|
871 | 871 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
872 | 872 | |
|
873 | 873 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
874 | 874 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
875 | 875 | save=False, figpath='./', figfile=None, show=True, |
|
876 | 876 | ftp=False, wr_period=1, server=None, |
|
877 | 877 | folder=None, username=None, password=None): |
|
878 | 878 | |
|
879 | 879 | |
|
880 | 880 | if channelList == None: |
|
881 | 881 | channelIndexList = dataOut.channelIndexList |
|
882 | 882 | channelList = dataOut.channelList |
|
883 | 883 | else: |
|
884 | 884 | channelIndexList = [] |
|
885 | 885 | for channel in channelList: |
|
886 | 886 | if channel not in dataOut.channelList: |
|
887 | 887 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
888 | 888 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
889 | 889 | |
|
890 | 890 | factor = dataOut.normFactor |
|
891 | 891 | |
|
892 | 892 | y = dataOut.getHeiRange() |
|
893 | 893 | |
|
894 | 894 | #for voltage |
|
895 | 895 | if dataOut.type == 'Voltage': |
|
896 | 896 | x = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:]) |
|
897 | 897 | x = x.real |
|
898 | 898 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
899 | 899 | |
|
900 | 900 | #for spectra |
|
901 | 901 | if dataOut.type == 'Spectra': |
|
902 | 902 | x = dataOut.data_spc[channelIndexList,:,:]/factor |
|
903 | 903 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
904 | 904 | x = numpy.average(x, axis=1) |
|
905 | 905 | |
|
906 | 906 | |
|
907 | 907 | xdB = 10*numpy.log10(x) |
|
908 | 908 | |
|
909 | 909 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
910 | 910 | title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
911 | 911 | xlabel = "dB" |
|
912 | 912 | ylabel = "Range (Km)" |
|
913 | 913 | |
|
914 | 914 | if not self.isConfig: |
|
915 | 915 | |
|
916 | 916 | nplots = 1 |
|
917 | 917 | |
|
918 | 918 | self.setup(id=id, |
|
919 | 919 | nplots=nplots, |
|
920 | 920 | wintitle=wintitle, |
|
921 | 921 | show=show) |
|
922 | 922 | |
|
923 | 923 | if ymin == None: ymin = numpy.nanmin(y) |
|
924 | 924 | if ymax == None: ymax = numpy.nanmax(y) |
|
925 | 925 | if xmin == None: xmin = numpy.nanmin(xdB)*0.9 |
|
926 | 926 | if xmax == None: xmax = numpy.nanmax(xdB)*1.1 |
|
927 | 927 | |
|
928 | 928 | self.isConfig = True |
|
929 | 929 | |
|
930 | 930 | self.setWinTitle(title) |
|
931 | 931 | |
|
932 | 932 | title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
933 | 933 | axes = self.axesList[0] |
|
934 | 934 | |
|
935 | 935 | legendlabels = ["channel %d"%x for x in channelList] |
|
936 | 936 | axes.pmultiline(xdB, y, |
|
937 | 937 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
938 | 938 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, |
|
939 | 939 | ytick_visible=True, nxticks=5, |
|
940 | 940 | grid='x') |
|
941 | 941 | |
|
942 | 942 | self.draw() |
|
943 | 943 | |
|
944 | 944 | self.save(figpath=figpath, |
|
945 | 945 | figfile=figfile, |
|
946 | 946 | save=save, |
|
947 | 947 | ftp=ftp, |
|
948 | 948 | wr_period=wr_period, |
|
949 | 949 | thisDatetime=thisDatetime) |
|
950 | 950 | |
|
951 | 951 | class SpectraCutPlot(Figure): |
|
952 | 952 | |
|
953 | 953 | isConfig = None |
|
954 | 954 | __nsubplots = None |
|
955 | 955 | |
|
956 | 956 | WIDTHPROF = None |
|
957 | 957 | HEIGHTPROF = None |
|
958 | 958 | PREFIX = 'spc_cut' |
|
959 | 959 | |
|
960 | 960 | def __init__(self): |
|
961 | 961 | self.isConfig = False |
|
962 | 962 | self.__nsubplots = 1 |
|
963 | 963 | |
|
964 | 964 | self.PLOT_CODE = POWER_CODE |
|
965 | 965 | |
|
966 | 966 | self.WIDTH = 700 |
|
967 | 967 | self.HEIGHT = 500 |
|
968 | 968 | self.counter_imagwr = 0 |
|
969 | 969 | |
|
970 | 970 | def getSubplots(self): |
|
971 | 971 | ncol = 1 |
|
972 | 972 | nrow = 1 |
|
973 | 973 | |
|
974 | 974 | return nrow, ncol |
|
975 | 975 | |
|
976 | 976 | def setup(self, id, nplots, wintitle, show): |
|
977 | 977 | |
|
978 | 978 | self.nplots = nplots |
|
979 | 979 | |
|
980 | 980 | ncolspan = 1 |
|
981 | 981 | colspan = 1 |
|
982 | 982 | |
|
983 | 983 | self.createFigure(id = id, |
|
984 | 984 | wintitle = wintitle, |
|
985 | 985 | widthplot = self.WIDTH, |
|
986 | 986 | heightplot = self.HEIGHT, |
|
987 | 987 | show=show) |
|
988 | 988 | |
|
989 | 989 | nrow, ncol = self.getSubplots() |
|
990 | 990 | |
|
991 | 991 | counter = 0 |
|
992 | 992 | for y in range(nrow): |
|
993 | 993 | for x in range(ncol): |
|
994 | 994 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
995 | 995 | |
|
996 | 996 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
997 | 997 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
998 | 998 | save=False, figpath='./', figfile=None, show=True, |
|
999 | 999 | ftp=False, wr_period=1, server=None, |
|
1000 | 1000 | folder=None, username=None, password=None, |
|
1001 | 1001 | xaxis="velocity"): |
|
1002 | 1002 | |
|
1003 | 1003 | |
|
1004 | 1004 | if channelList == None: |
|
1005 | 1005 | channelIndexList = dataOut.channelIndexList |
|
1006 | 1006 | channelList = dataOut.channelList |
|
1007 | 1007 | else: |
|
1008 | 1008 | channelIndexList = [] |
|
1009 | 1009 | for channel in channelList: |
|
1010 | 1010 | if channel not in dataOut.channelList: |
|
1011 | 1011 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
1012 | 1012 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
1013 | 1013 | |
|
1014 | 1014 | factor = dataOut.normFactor |
|
1015 | 1015 | |
|
1016 | 1016 | y = dataOut.getHeiRange() |
|
1017 | 1017 | |
|
1018 | 1018 | z = dataOut.data_spc/factor |
|
1019 | 1019 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
1020 | 1020 | |
|
1021 | 1021 | hei_index = numpy.arange(25)*3 + 20 |
|
1022 | 1022 | |
|
1023 | 1023 | if xaxis == "frequency": |
|
1024 | 1024 | x = dataOut.getFreqRange()/1000. |
|
1025 | 1025 | zdB = 10*numpy.log10(z[0,:,hei_index]) |
|
1026 | 1026 | xlabel = "Frequency (kHz)" |
|
1027 | 1027 | ylabel = "Power (dB)" |
|
1028 | 1028 | |
|
1029 | 1029 | elif xaxis == "time": |
|
1030 | 1030 | x = dataOut.getAcfRange() |
|
1031 | 1031 | zdB = z[0,:,hei_index] |
|
1032 | 1032 | xlabel = "Time (ms)" |
|
1033 | 1033 | ylabel = "ACF" |
|
1034 | 1034 | |
|
1035 | 1035 | else: |
|
1036 | 1036 | x = dataOut.getVelRange() |
|
1037 | 1037 | zdB = 10*numpy.log10(z[0,:,hei_index]) |
|
1038 | 1038 | xlabel = "Velocity (m/s)" |
|
1039 | 1039 | ylabel = "Power (dB)" |
|
1040 | 1040 | |
|
1041 | 1041 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
1042 | 1042 | title = wintitle + " Range Cuts %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1043 | 1043 | |
|
1044 | 1044 | if not self.isConfig: |
|
1045 | 1045 | |
|
1046 | 1046 | nplots = 1 |
|
1047 | 1047 | |
|
1048 | 1048 | self.setup(id=id, |
|
1049 | 1049 | nplots=nplots, |
|
1050 | 1050 | wintitle=wintitle, |
|
1051 | 1051 | show=show) |
|
1052 | 1052 | |
|
1053 | 1053 | if xmin == None: xmin = numpy.nanmin(x)*0.9 |
|
1054 | 1054 | if xmax == None: xmax = numpy.nanmax(x)*1.1 |
|
1055 | 1055 | if ymin == None: ymin = numpy.nanmin(zdB) |
|
1056 | 1056 | if ymax == None: ymax = numpy.nanmax(zdB) |
|
1057 | 1057 | |
|
1058 | 1058 | self.isConfig = True |
|
1059 | 1059 | |
|
1060 | 1060 | self.setWinTitle(title) |
|
1061 | 1061 | |
|
1062 | 1062 | title = "Spectra Cuts: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
1063 | 1063 | axes = self.axesList[0] |
|
1064 | 1064 | |
|
1065 | 1065 | legendlabels = ["Range = %dKm" %y[i] for i in hei_index] |
|
1066 | 1066 | |
|
1067 | 1067 | axes.pmultilineyaxis( x, zdB, |
|
1068 | 1068 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
1069 | 1069 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, |
|
1070 | 1070 | ytick_visible=True, nxticks=5, |
|
1071 | 1071 | grid='x') |
|
1072 | 1072 | |
|
1073 | 1073 | self.draw() |
|
1074 | 1074 | |
|
1075 | 1075 | self.save(figpath=figpath, |
|
1076 | 1076 | figfile=figfile, |
|
1077 | 1077 | save=save, |
|
1078 | 1078 | ftp=ftp, |
|
1079 | 1079 | wr_period=wr_period, |
|
1080 | 1080 | thisDatetime=thisDatetime) |
|
1081 | 1081 | |
|
1082 | 1082 | class Noise(Figure): |
|
1083 | 1083 | |
|
1084 | 1084 | isConfig = None |
|
1085 | 1085 | __nsubplots = None |
|
1086 | 1086 | |
|
1087 | 1087 | PREFIX = 'noise' |
|
1088 | 1088 | |
|
1089 | 1089 | def __init__(self): |
|
1090 | 1090 | |
|
1091 | 1091 | self.timerange = 24*60*60 |
|
1092 | 1092 | self.isConfig = False |
|
1093 | 1093 | self.__nsubplots = 1 |
|
1094 | 1094 | self.counter_imagwr = 0 |
|
1095 | 1095 | self.WIDTH = 800 |
|
1096 | 1096 | self.HEIGHT = 400 |
|
1097 | 1097 | self.WIDTHPROF = 120 |
|
1098 | 1098 | self.HEIGHTPROF = 0 |
|
1099 | 1099 | self.xdata = None |
|
1100 | 1100 | self.ydata = None |
|
1101 | 1101 | |
|
1102 | 1102 | self.PLOT_CODE = NOISE_CODE |
|
1103 | 1103 | |
|
1104 | 1104 | self.FTP_WEI = None |
|
1105 | 1105 | self.EXP_CODE = None |
|
1106 | 1106 | self.SUB_EXP_CODE = None |
|
1107 | 1107 | self.PLOT_POS = None |
|
1108 | 1108 | self.figfile = None |
|
1109 | 1109 | |
|
1110 | 1110 | self.xmin = None |
|
1111 | 1111 | self.xmax = None |
|
1112 | 1112 | |
|
1113 | 1113 | def getSubplots(self): |
|
1114 | 1114 | |
|
1115 | 1115 | ncol = 1 |
|
1116 | 1116 | nrow = 1 |
|
1117 | 1117 | |
|
1118 | 1118 | return nrow, ncol |
|
1119 | 1119 | |
|
1120 | 1120 | def openfile(self, filename): |
|
1121 | 1121 | dirname = os.path.dirname(filename) |
|
1122 | 1122 | |
|
1123 | 1123 | if not os.path.exists(dirname): |
|
1124 | 1124 | os.mkdir(dirname) |
|
1125 | 1125 | |
|
1126 | 1126 | f = open(filename,'w+') |
|
1127 | 1127 | f.write('\n\n') |
|
1128 | 1128 | f.write('JICAMARCA RADIO OBSERVATORY - Noise \n') |
|
1129 | 1129 | f.write('DD MM YYYY HH MM SS Channel0 Channel1 Channel2 Channel3\n\n' ) |
|
1130 | 1130 | f.close() |
|
1131 | 1131 | |
|
1132 | 1132 | def save_data(self, filename_phase, data, data_datetime): |
|
1133 | 1133 | |
|
1134 | 1134 | f=open(filename_phase,'a') |
|
1135 | 1135 | |
|
1136 | 1136 | timetuple_data = data_datetime.timetuple() |
|
1137 | 1137 | day = str(timetuple_data.tm_mday) |
|
1138 | 1138 | month = str(timetuple_data.tm_mon) |
|
1139 | 1139 | year = str(timetuple_data.tm_year) |
|
1140 | 1140 | hour = str(timetuple_data.tm_hour) |
|
1141 | 1141 | minute = str(timetuple_data.tm_min) |
|
1142 | 1142 | second = str(timetuple_data.tm_sec) |
|
1143 | 1143 | |
|
1144 | 1144 | data_msg = '' |
|
1145 | 1145 | for i in range(len(data)): |
|
1146 | 1146 | data_msg += str(data[i]) + ' ' |
|
1147 | 1147 | |
|
1148 | 1148 | f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' ' + data_msg + '\n') |
|
1149 | 1149 | f.close() |
|
1150 | 1150 | |
|
1151 | 1151 | |
|
1152 | 1152 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1153 | 1153 | |
|
1154 | 1154 | self.__showprofile = showprofile |
|
1155 | 1155 | self.nplots = nplots |
|
1156 | 1156 | |
|
1157 | 1157 | ncolspan = 7 |
|
1158 | 1158 | colspan = 6 |
|
1159 | 1159 | self.__nsubplots = 2 |
|
1160 | 1160 | |
|
1161 | 1161 | self.createFigure(id = id, |
|
1162 | 1162 | wintitle = wintitle, |
|
1163 | 1163 | widthplot = self.WIDTH+self.WIDTHPROF, |
|
1164 | 1164 | heightplot = self.HEIGHT+self.HEIGHTPROF, |
|
1165 | 1165 | show=show) |
|
1166 | 1166 | |
|
1167 | 1167 | nrow, ncol = self.getSubplots() |
|
1168 | 1168 | |
|
1169 | 1169 | self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1) |
|
1170 | 1170 | |
|
1171 | 1171 | |
|
1172 | 1172 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True', |
|
1173 | 1173 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1174 | 1174 | timerange=None, |
|
1175 | 1175 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1176 | 1176 | server=None, folder=None, username=None, password=None, |
|
1177 | 1177 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1178 | 1178 | |
|
1179 | 1179 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
1180 | 1180 | return |
|
1181 | 1181 | |
|
1182 | 1182 | if channelList == None: |
|
1183 | 1183 | channelIndexList = dataOut.channelIndexList |
|
1184 | 1184 | channelList = dataOut.channelList |
|
1185 | 1185 | else: |
|
1186 | 1186 | channelIndexList = [] |
|
1187 | 1187 | for channel in channelList: |
|
1188 | 1188 | if channel not in dataOut.channelList: |
|
1189 | 1189 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
1190 | 1190 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
1191 | 1191 | |
|
1192 | 1192 | x = dataOut.getTimeRange() |
|
1193 | 1193 | #y = dataOut.getHeiRange() |
|
1194 | 1194 | factor = dataOut.normFactor |
|
1195 | 1195 | noise = dataOut.noise[channelIndexList]/factor |
|
1196 | 1196 | noisedB = 10*numpy.log10(noise) |
|
1197 | 1197 | |
|
1198 | 1198 | thisDatetime = dataOut.datatime |
|
1199 | 1199 | |
|
1200 | 1200 | title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1201 | 1201 | xlabel = "" |
|
1202 | 1202 | ylabel = "Intensity (dB)" |
|
1203 | 1203 | update_figfile = False |
|
1204 | 1204 | |
|
1205 | 1205 | if not self.isConfig: |
|
1206 | 1206 | |
|
1207 | 1207 | nplots = 1 |
|
1208 | 1208 | |
|
1209 | 1209 | self.setup(id=id, |
|
1210 | 1210 | nplots=nplots, |
|
1211 | 1211 | wintitle=wintitle, |
|
1212 | 1212 | showprofile=showprofile, |
|
1213 | 1213 | show=show) |
|
1214 | 1214 | |
|
1215 | 1215 | if timerange != None: |
|
1216 | 1216 | self.timerange = timerange |
|
1217 | 1217 | |
|
1218 | 1218 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1219 | 1219 | |
|
1220 | 1220 | if ymin == None: ymin = numpy.floor(numpy.nanmin(noisedB)) - 10.0 |
|
1221 | 1221 | if ymax == None: ymax = numpy.nanmax(noisedB) + 10.0 |
|
1222 | 1222 | |
|
1223 | 1223 | self.FTP_WEI = ftp_wei |
|
1224 | 1224 | self.EXP_CODE = exp_code |
|
1225 | 1225 | self.SUB_EXP_CODE = sub_exp_code |
|
1226 | 1226 | self.PLOT_POS = plot_pos |
|
1227 | 1227 | |
|
1228 | 1228 | |
|
1229 | 1229 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1230 | 1230 | self.isConfig = True |
|
1231 | 1231 | self.figfile = figfile |
|
1232 | 1232 | self.xdata = numpy.array([]) |
|
1233 | 1233 | self.ydata = numpy.array([]) |
|
1234 | 1234 | |
|
1235 | 1235 | update_figfile = True |
|
1236 | 1236 | |
|
1237 | 1237 | #open file beacon phase |
|
1238 | 1238 | path = '%s%03d' %(self.PREFIX, self.id) |
|
1239 | 1239 | noise_file = os.path.join(path,'%s.txt'%self.name) |
|
1240 | 1240 | self.filename_noise = os.path.join(figpath,noise_file) |
|
1241 | 1241 | |
|
1242 | 1242 | self.setWinTitle(title) |
|
1243 | 1243 | |
|
1244 | 1244 | title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1245 | 1245 | |
|
1246 | 1246 | legendlabels = ["channel %d"%(idchannel) for idchannel in channelList] |
|
1247 | 1247 | axes = self.axesList[0] |
|
1248 | 1248 | |
|
1249 | 1249 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
|
1250 | 1250 | |
|
1251 | 1251 | if len(self.ydata)==0: |
|
1252 | 1252 | self.ydata = noisedB.reshape(-1,1) |
|
1253 | 1253 | else: |
|
1254 | 1254 | self.ydata = numpy.hstack((self.ydata, noisedB.reshape(-1,1))) |
|
1255 | 1255 | |
|
1256 | 1256 | |
|
1257 | 1257 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1258 | 1258 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, |
|
1259 | 1259 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1260 | 1260 | XAxisAsTime=True, grid='both' |
|
1261 | 1261 | ) |
|
1262 | 1262 | |
|
1263 | 1263 | self.draw() |
|
1264 | 1264 | |
|
1265 | 1265 | if dataOut.ltctime >= self.xmax: |
|
1266 | 1266 | self.counter_imagwr = wr_period |
|
1267 | 1267 | self.isConfig = False |
|
1268 | 1268 | update_figfile = True |
|
1269 | 1269 | |
|
1270 | 1270 | self.save(figpath=figpath, |
|
1271 | 1271 | figfile=figfile, |
|
1272 | 1272 | save=save, |
|
1273 | 1273 | ftp=ftp, |
|
1274 | 1274 | wr_period=wr_period, |
|
1275 | 1275 | thisDatetime=thisDatetime, |
|
1276 | 1276 | update_figfile=update_figfile) |
|
1277 | 1277 | |
|
1278 | 1278 | #store data beacon phase |
|
1279 | 1279 | if save: |
|
1280 | 1280 | self.save_data(self.filename_noise, noisedB, thisDatetime) |
|
1281 | 1281 | |
|
1282 | 1282 | class BeaconPhase(Figure): |
|
1283 | 1283 | |
|
1284 | 1284 | __isConfig = None |
|
1285 | 1285 | __nsubplots = None |
|
1286 | 1286 | |
|
1287 | 1287 | PREFIX = 'beacon_phase' |
|
1288 | 1288 | |
|
1289 | 1289 | def __init__(self): |
|
1290 | 1290 | |
|
1291 | 1291 | self.timerange = 24*60*60 |
|
1292 | 1292 | self.isConfig = False |
|
1293 | 1293 | self.__nsubplots = 1 |
|
1294 | 1294 | self.counter_imagwr = 0 |
|
1295 | 1295 | self.WIDTH = 800 |
|
1296 | 1296 | self.HEIGHT = 400 |
|
1297 | 1297 | self.WIDTHPROF = 120 |
|
1298 | 1298 | self.HEIGHTPROF = 0 |
|
1299 | 1299 | self.xdata = None |
|
1300 | 1300 | self.ydata = None |
|
1301 | 1301 | |
|
1302 | 1302 | self.PLOT_CODE = BEACON_CODE |
|
1303 | 1303 | |
|
1304 | 1304 | self.FTP_WEI = None |
|
1305 | 1305 | self.EXP_CODE = None |
|
1306 | 1306 | self.SUB_EXP_CODE = None |
|
1307 | 1307 | self.PLOT_POS = None |
|
1308 | 1308 | |
|
1309 | 1309 | self.filename_phase = None |
|
1310 | 1310 | |
|
1311 | 1311 | self.figfile = None |
|
1312 | 1312 | |
|
1313 | 1313 | self.xmin = None |
|
1314 | 1314 | self.xmax = None |
|
1315 | 1315 | |
|
1316 | 1316 | def getSubplots(self): |
|
1317 | 1317 | |
|
1318 | 1318 | ncol = 1 |
|
1319 | 1319 | nrow = 1 |
|
1320 | 1320 | |
|
1321 | 1321 | return nrow, ncol |
|
1322 | 1322 | |
|
1323 | 1323 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1324 | 1324 | |
|
1325 | 1325 | self.__showprofile = showprofile |
|
1326 | 1326 | self.nplots = nplots |
|
1327 | 1327 | |
|
1328 | 1328 | ncolspan = 7 |
|
1329 | 1329 | colspan = 6 |
|
1330 | 1330 | self.__nsubplots = 2 |
|
1331 | 1331 | |
|
1332 | 1332 | self.createFigure(id = id, |
|
1333 | 1333 | wintitle = wintitle, |
|
1334 | 1334 | widthplot = self.WIDTH+self.WIDTHPROF, |
|
1335 | 1335 | heightplot = self.HEIGHT+self.HEIGHTPROF, |
|
1336 | 1336 | show=show) |
|
1337 | 1337 | |
|
1338 | 1338 | nrow, ncol = self.getSubplots() |
|
1339 | 1339 | |
|
1340 | 1340 | self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1) |
|
1341 | 1341 | |
|
1342 | 1342 | def save_phase(self, filename_phase): |
|
1343 | 1343 | f = open(filename_phase,'w+') |
|
1344 | 1344 | f.write('\n\n') |
|
1345 | 1345 | f.write('JICAMARCA RADIO OBSERVATORY - Beacon Phase \n') |
|
1346 | 1346 | f.write('DD MM YYYY HH MM SS pair(2,0) pair(2,1) pair(2,3) pair(2,4)\n\n' ) |
|
1347 | 1347 | f.close() |
|
1348 | 1348 | |
|
1349 | 1349 | def save_data(self, filename_phase, data, data_datetime): |
|
1350 | 1350 | f=open(filename_phase,'a') |
|
1351 | 1351 | timetuple_data = data_datetime.timetuple() |
|
1352 | 1352 | day = str(timetuple_data.tm_mday) |
|
1353 | 1353 | month = str(timetuple_data.tm_mon) |
|
1354 | 1354 | year = str(timetuple_data.tm_year) |
|
1355 | 1355 | hour = str(timetuple_data.tm_hour) |
|
1356 | 1356 | minute = str(timetuple_data.tm_min) |
|
1357 | 1357 | second = str(timetuple_data.tm_sec) |
|
1358 | 1358 | f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' '+str(data[0])+' '+str(data[1])+' '+str(data[2])+' '+str(data[3])+'\n') |
|
1359 | 1359 | f.close() |
|
1360 | 1360 | |
|
1361 | 1361 | |
|
1362 | 1362 | def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True', |
|
1363 | 1363 | xmin=None, xmax=None, ymin=None, ymax=None, hmin=None, hmax=None, |
|
1364 | 1364 | timerange=None, |
|
1365 | 1365 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1366 | 1366 | server=None, folder=None, username=None, password=None, |
|
1367 | 1367 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1368 | 1368 | |
|
1369 | 1369 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
1370 | 1370 | return |
|
1371 | 1371 | |
|
1372 | 1372 | if pairsList == None: |
|
1373 | 1373 | pairsIndexList = dataOut.pairsIndexList[:10] |
|
1374 | 1374 | else: |
|
1375 | 1375 | pairsIndexList = [] |
|
1376 | 1376 | for pair in pairsList: |
|
1377 | 1377 | if pair not in dataOut.pairsList: |
|
1378 | 1378 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
1379 | 1379 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
1380 | 1380 | |
|
1381 | 1381 | if pairsIndexList == []: |
|
1382 | 1382 | return |
|
1383 | 1383 | |
|
1384 | 1384 | # if len(pairsIndexList) > 4: |
|
1385 | 1385 | # pairsIndexList = pairsIndexList[0:4] |
|
1386 | 1386 | |
|
1387 | 1387 | hmin_index = None |
|
1388 | 1388 | hmax_index = None |
|
1389 | 1389 | |
|
1390 | 1390 | if hmin != None and hmax != None: |
|
1391 | 1391 | indexes = numpy.arange(dataOut.nHeights) |
|
1392 | 1392 | hmin_list = indexes[dataOut.heightList >= hmin] |
|
1393 | 1393 | hmax_list = indexes[dataOut.heightList <= hmax] |
|
1394 | 1394 | |
|
1395 | 1395 | if hmin_list.any(): |
|
1396 | 1396 | hmin_index = hmin_list[0] |
|
1397 | 1397 | |
|
1398 | 1398 | if hmax_list.any(): |
|
1399 | 1399 | hmax_index = hmax_list[-1]+1 |
|
1400 | 1400 | |
|
1401 | 1401 | x = dataOut.getTimeRange() |
|
1402 | 1402 | #y = dataOut.getHeiRange() |
|
1403 | 1403 | |
|
1404 | 1404 | |
|
1405 | 1405 | thisDatetime = dataOut.datatime |
|
1406 | 1406 | |
|
1407 | 1407 | title = wintitle + " Signal Phase" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1408 | 1408 | xlabel = "Local Time" |
|
1409 | 1409 | ylabel = "Phase (degrees)" |
|
1410 | 1410 | |
|
1411 | 1411 | update_figfile = False |
|
1412 | 1412 | |
|
1413 | 1413 | nplots = len(pairsIndexList) |
|
1414 | 1414 | #phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList))) |
|
1415 | 1415 | phase_beacon = numpy.zeros(len(pairsIndexList)) |
|
1416 | 1416 | for i in range(nplots): |
|
1417 | 1417 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
1418 | 1418 | ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i], :, hmin_index:hmax_index], axis=0) |
|
1419 | 1419 | powa = numpy.average(dataOut.data_spc[pair[0], :, hmin_index:hmax_index], axis=0) |
|
1420 | 1420 | powb = numpy.average(dataOut.data_spc[pair[1], :, hmin_index:hmax_index], axis=0) |
|
1421 | 1421 | avgcoherenceComplex = ccf/numpy.sqrt(powa*powb) |
|
1422 | 1422 | phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi |
|
1423 | 1423 | |
|
1424 | 1424 | #print "Phase %d%d" %(pair[0], pair[1]) |
|
1425 | 1425 | #print phase[dataOut.beacon_heiIndexList] |
|
1426 | 1426 | |
|
1427 | 1427 | if dataOut.beacon_heiIndexList: |
|
1428 | 1428 | phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList]) |
|
1429 | 1429 | else: |
|
1430 | 1430 | phase_beacon[i] = numpy.average(phase) |
|
1431 | 1431 | |
|
1432 | 1432 | if not self.isConfig: |
|
1433 | 1433 | |
|
1434 | 1434 | nplots = len(pairsIndexList) |
|
1435 | 1435 | |
|
1436 | 1436 | self.setup(id=id, |
|
1437 | 1437 | nplots=nplots, |
|
1438 | 1438 | wintitle=wintitle, |
|
1439 | 1439 | showprofile=showprofile, |
|
1440 | 1440 | show=show) |
|
1441 | 1441 | |
|
1442 | 1442 | if timerange != None: |
|
1443 | 1443 | self.timerange = timerange |
|
1444 | 1444 | |
|
1445 | 1445 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1446 | 1446 | |
|
1447 | 1447 | if ymin == None: ymin = 0 |
|
1448 | 1448 | if ymax == None: ymax = 360 |
|
1449 | 1449 | |
|
1450 | 1450 | self.FTP_WEI = ftp_wei |
|
1451 | 1451 | self.EXP_CODE = exp_code |
|
1452 | 1452 | self.SUB_EXP_CODE = sub_exp_code |
|
1453 | 1453 | self.PLOT_POS = plot_pos |
|
1454 | 1454 | |
|
1455 | 1455 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1456 | 1456 | self.isConfig = True |
|
1457 | 1457 | self.figfile = figfile |
|
1458 | 1458 | self.xdata = numpy.array([]) |
|
1459 | 1459 | self.ydata = numpy.array([]) |
|
1460 | 1460 | |
|
1461 | 1461 | update_figfile = True |
|
1462 | 1462 | |
|
1463 | 1463 | #open file beacon phase |
|
1464 | 1464 | path = '%s%03d' %(self.PREFIX, self.id) |
|
1465 | 1465 | beacon_file = os.path.join(path,'%s.txt'%self.name) |
|
1466 | 1466 | self.filename_phase = os.path.join(figpath,beacon_file) |
|
1467 | 1467 | #self.save_phase(self.filename_phase) |
|
1468 | 1468 | |
|
1469 | 1469 | |
|
1470 | 1470 | #store data beacon phase |
|
1471 | 1471 | #self.save_data(self.filename_phase, phase_beacon, thisDatetime) |
|
1472 | 1472 | |
|
1473 | 1473 | self.setWinTitle(title) |
|
1474 | 1474 | |
|
1475 | 1475 | |
|
1476 | 1476 | title = "Phase Plot %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1477 | 1477 | |
|
1478 | 1478 | legendlabels = ["Pair (%d,%d)"%(pair[0], pair[1]) for pair in dataOut.pairsList] |
|
1479 | 1479 | |
|
1480 | 1480 | axes = self.axesList[0] |
|
1481 | 1481 | |
|
1482 | 1482 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
|
1483 | 1483 | |
|
1484 | 1484 | if len(self.ydata)==0: |
|
1485 | 1485 | self.ydata = phase_beacon.reshape(-1,1) |
|
1486 | 1486 | else: |
|
1487 | 1487 | self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1))) |
|
1488 | 1488 | |
|
1489 | 1489 | |
|
1490 | 1490 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1491 | 1491 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, |
|
1492 | 1492 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1493 | 1493 | XAxisAsTime=True, grid='both' |
|
1494 | 1494 | ) |
|
1495 | 1495 | |
|
1496 | 1496 | self.draw() |
|
1497 | 1497 | |
|
1498 | 1498 | if dataOut.ltctime >= self.xmax: |
|
1499 | 1499 | self.counter_imagwr = wr_period |
|
1500 | 1500 | self.isConfig = False |
|
1501 | 1501 | update_figfile = True |
|
1502 | 1502 | |
|
1503 | 1503 | self.save(figpath=figpath, |
|
1504 | 1504 | figfile=figfile, |
|
1505 | 1505 | save=save, |
|
1506 | 1506 | ftp=ftp, |
|
1507 | 1507 | wr_period=wr_period, |
|
1508 | 1508 | thisDatetime=thisDatetime, |
|
1509 | 1509 | update_figfile=update_figfile) |
General Comments 0
You need to be logged in to leave comments.
Login now