@@ -0,0 +1,87 | |||
|
1 | """ | |
|
2 | Classes to save parameters from Windows. | |
|
3 | ||
|
4 | -Project window | |
|
5 | -Voltage window | |
|
6 | -Spectra window | |
|
7 | -SpectraHeis window | |
|
8 | -Correlation window | |
|
9 | ||
|
10 | """ | |
|
11 | ||
|
12 | class ProjectParms(): | |
|
13 | ||
|
14 | parmsOk = False | |
|
15 | project_name = None | |
|
16 | datatype = None | |
|
17 | ext = None | |
|
18 | dpath = None | |
|
19 | startDate = None | |
|
20 | endDate = None | |
|
21 | startTime = None | |
|
22 | endTime = None | |
|
23 | online = None | |
|
24 | delay = None | |
|
25 | walk = None | |
|
26 | expLabel = None | |
|
27 | set = None | |
|
28 | ippKm = None | |
|
29 | ||
|
30 | def __init__(self): | |
|
31 | ||
|
32 | self.parmsOk = True | |
|
33 | self.expLabel = '' | |
|
34 | self.set = None | |
|
35 | self.ippKm = None | |
|
36 | self.walk = None | |
|
37 | self.delay = None | |
|
38 | ||
|
39 | def getDatatypeIndex(self): | |
|
40 | ||
|
41 | indexDatatype = None | |
|
42 | ||
|
43 | if self.datatype.lower() == 'voltage': | |
|
44 | indexDatatype = 0 | |
|
45 | if self.datatype.lower() == 'spectra': | |
|
46 | indexDatatype = 1 | |
|
47 | if self.datatype.lower() == 'fits': | |
|
48 | indexDatatype = 2 | |
|
49 | if self.datatype.lower() == 'usrp': | |
|
50 | indexDatatype = 3 | |
|
51 | ||
|
52 | return indexDatatype | |
|
53 | ||
|
54 | def getExt(self): | |
|
55 | ||
|
56 | ext = None | |
|
57 | ||
|
58 | if self.datatype.lower() == 'voltage': | |
|
59 | ext = '.r' | |
|
60 | if self.datatype.lower() == 'spectra': | |
|
61 | ext = '.pdata' | |
|
62 | if self.datatype.lower() == 'fits': | |
|
63 | ext = '.fits' | |
|
64 | if self.datatype.lower() == 'usrp': | |
|
65 | ext = '.hdf5' | |
|
66 | ||
|
67 | return ext | |
|
68 | ||
|
69 | def set(self, project_name, datatype, ext, dpath, online, | |
|
70 | startDate=None, endDate=None, startTime=None, endTime=None, | |
|
71 | delay=None, walk=None, set=None, ippKm=None, parmsOk=True): | |
|
72 | ||
|
73 | project_name = project_name | |
|
74 | datatype = datatype | |
|
75 | ext = ext | |
|
76 | dpath = dpath | |
|
77 | startDate = startDate | |
|
78 | endDate = endDate | |
|
79 | startTime = startTime | |
|
80 | endTime = endTime | |
|
81 | online = online | |
|
82 | delay = delay | |
|
83 | walk = walk | |
|
84 | set = set | |
|
85 | ippKm = ippKm | |
|
86 | ||
|
87 | self.parmsOk = parmsOk No newline at end of file |
@@ -0,0 +1,211 | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | """ | |
|
3 | This module contains every model class to create, modify and show a property tree on a GUI. | |
|
4 | """ | |
|
5 | ||
|
6 | from PyQt4 import QtCore | |
|
7 | import itertools | |
|
8 | ||
|
9 | HORIZONTAL_HEADERS = ("Property","Value " ) | |
|
10 | ||
|
11 | HORIZONTAL = ("RAMA :",) | |
|
12 | ||
|
13 | class PropertyBuffer(): | |
|
14 | ||
|
15 | def __init__(self): | |
|
16 | ||
|
17 | self.clear() | |
|
18 | ||
|
19 | def clear(self): | |
|
20 | ||
|
21 | self.headerList = [] | |
|
22 | self.parmList = [] | |
|
23 | self.valueList = [] | |
|
24 | ||
|
25 | def append(self, header, parm, value): | |
|
26 | ||
|
27 | self.headerList.append(header) | |
|
28 | self.parmList.append(parm) | |
|
29 | self.valueList.append(value) | |
|
30 | ||
|
31 | return | |
|
32 | ||
|
33 | def get(self): | |
|
34 | ||
|
35 | return self.headerList, self.parmList, self.valueList | |
|
36 | ||
|
37 | def getPropertyModel(self): | |
|
38 | ||
|
39 | propertiesModel = TreeModel() | |
|
40 | propertiesModel.showProperties(self.headerList, self.parmList, self.valueList) | |
|
41 | ||
|
42 | return propertiesModel | |
|
43 | ||
|
44 | ||
|
45 | class TreeModel(QtCore.QAbstractItemModel): | |
|
46 | ''' | |
|
47 | a model to display a few names, ordered by encabezado | |
|
48 | ||
|
49 | ''' | |
|
50 | def __init__(self ,parent=None): | |
|
51 | super(TreeModel, self).__init__(parent) | |
|
52 | self.people = [] | |
|
53 | ||
|
54 | def initProjectView(self): | |
|
55 | """ | |
|
56 | Reemplazo del mΓ©todo showtree | |
|
57 | """ | |
|
58 | HORIZONTAL_HEADERS = ("Property","Value " ) | |
|
59 | HORIZONTAL = ("RAMA :",) | |
|
60 | self.rootItem = TreeItem(None, "ALL", None) | |
|
61 | self.parents = {0 : self.rootItem} | |
|
62 | self.__setupModelData() | |
|
63 | ||
|
64 | def initPUVoltageView(self): | |
|
65 | HORIZONTAL_HEADERS = ("Operation"," Parameter Value " ) | |
|
66 | HORIZONTAL = ("RAMA :",) | |
|
67 | self.rootItem = TreeItem(None, "ALL", None) | |
|
68 | self.parents = {0 : self.rootItem} | |
|
69 | self.__setupModelData() | |
|
70 | ||
|
71 | def showProperties(self,headerList, parmList, valueList): | |
|
72 | """ | |
|
73 | set2Obje | |
|
74 | """ | |
|
75 | for header, parameter, value in itertools.izip(headerList, parmList, valueList): | |
|
76 | person = person_class(header, parameter, value) | |
|
77 | self.people.append(person) | |
|
78 | ||
|
79 | self.rootItem = TreeItem(None, "ALL", None) | |
|
80 | self.parents = {0 : self.rootItem} | |
|
81 | self.__setupModelData() | |
|
82 | ||
|
83 | def columnCount(self, parent=None): | |
|
84 | if parent and parent.isValid(): | |
|
85 | return parent.internalPointer().columnCount() | |
|
86 | else: | |
|
87 | return len(HORIZONTAL_HEADERS) | |
|
88 | ||
|
89 | def data(self, index, role): | |
|
90 | if not index.isValid(): | |
|
91 | return QtCore.QVariant() | |
|
92 | ||
|
93 | item = index.internalPointer() | |
|
94 | if role == QtCore.Qt.DisplayRole: | |
|
95 | return item.data(index.column()) | |
|
96 | if role == QtCore.Qt.UserRole: | |
|
97 | if item: | |
|
98 | return item.person | |
|
99 | ||
|
100 | return QtCore.QVariant() | |
|
101 | ||
|
102 | def index(self, row, column, parent): | |
|
103 | if not self.hasIndex(row, column, parent): | |
|
104 | return QtCore.QModelIndex() | |
|
105 | ||
|
106 | if not parent.isValid(): | |
|
107 | parentItem = self.rootItem | |
|
108 | else: | |
|
109 | parentItem = parent.internalPointer() | |
|
110 | ||
|
111 | childItem = parentItem.child(row) | |
|
112 | if childItem: | |
|
113 | return self.createIndex(row, column, childItem) | |
|
114 | else: | |
|
115 | return QtCore.QModelIndex() | |
|
116 | ||
|
117 | def parent(self, index): | |
|
118 | if not index.isValid(): | |
|
119 | return QtCore.QModelIndex() | |
|
120 | ||
|
121 | childItem = index.internalPointer() | |
|
122 | if not childItem: | |
|
123 | return QtCore.QModelIndex() | |
|
124 | ||
|
125 | parentItem = childItem.parent() | |
|
126 | ||
|
127 | if parentItem == self.rootItem: | |
|
128 | return QtCore.QModelIndex() | |
|
129 | ||
|
130 | return self.createIndex(parentItem.row(), 0, parentItem) | |
|
131 | ||
|
132 | def rowCount(self, parent=QtCore.QModelIndex()): | |
|
133 | if parent.column() > 0: | |
|
134 | return 0 | |
|
135 | if not parent.isValid(): | |
|
136 | p_Item = self.rootItem | |
|
137 | else: | |
|
138 | p_Item = parent.internalPointer() | |
|
139 | return p_Item.childCount() | |
|
140 | ||
|
141 | def __setupModelData(self): | |
|
142 | for person in self.people: | |
|
143 | if person.value: | |
|
144 | encabezado = person.header | |
|
145 | ||
|
146 | if not self.parents.has_key(encabezado): | |
|
147 | newparent = TreeItem(None, encabezado, self.rootItem) | |
|
148 | self.rootItem.appendChild(newparent) | |
|
149 | ||
|
150 | self.parents[encabezado] = newparent | |
|
151 | ||
|
152 | parentItem = self.parents[encabezado] | |
|
153 | newItem = TreeItem(person, "", parentItem) | |
|
154 | parentItem.appendChild(newItem) | |
|
155 | ||
|
156 | class person_class(object): | |
|
157 | ''' | |
|
158 | a trivial custom data object | |
|
159 | ''' | |
|
160 | def __init__(self, header, parameter, value): | |
|
161 | self.header = header | |
|
162 | self.parameter = parameter | |
|
163 | self.value = value | |
|
164 | ||
|
165 | def __repr__(self): | |
|
166 | return "PERSON - %s %s"% (self.parameter, self.header) | |
|
167 | ||
|
168 | class TreeItem(object): | |
|
169 | ''' | |
|
170 | a python object used to return row/column data, and keep note of | |
|
171 | it's parents and/or children | |
|
172 | ''' | |
|
173 | def __init__(self, person, header, parentItem): | |
|
174 | self.person = person | |
|
175 | self.parentItem = parentItem | |
|
176 | self.header = header | |
|
177 | self.childItems = [] | |
|
178 | ||
|
179 | def appendChild(self, item): | |
|
180 | self.childItems.append(item) | |
|
181 | ||
|
182 | def child(self, row): | |
|
183 | return self.childItems[row] | |
|
184 | ||
|
185 | def childCount(self): | |
|
186 | return len(self.childItems) | |
|
187 | ||
|
188 | def columnCount(self): | |
|
189 | return 2 | |
|
190 | ||
|
191 | def data(self, column): | |
|
192 | if self.person == None: | |
|
193 | if column == 0: | |
|
194 | return QtCore.QVariant(self.header) | |
|
195 | if column == 1: | |
|
196 | return QtCore.QVariant("") | |
|
197 | else: | |
|
198 | if column == 0: | |
|
199 | return QtCore.QVariant(self.person.parameter) | |
|
200 | if column == 1: | |
|
201 | return QtCore.QVariant(self.person.value) | |
|
202 | return QtCore.QVariant() | |
|
203 | ||
|
204 | def parent(self): | |
|
205 | return self.parentItem | |
|
206 | ||
|
207 | def row(self): | |
|
208 | if self.parentItem: | |
|
209 | return self.parentItem.childItems.index(self) | |
|
210 | return 0 | |
|
211 | No newline at end of file |
@@ -203,7 +203,7 class OperationConf(): | |||
|
203 | 203 | |
|
204 | 204 | def __init__(self): |
|
205 | 205 | |
|
206 | self.id = 0 | |
|
206 | self.id = '0' | |
|
207 | 207 | self.name = None |
|
208 | 208 | self.priority = None |
|
209 | 209 | self.type = 'self' |
@@ -386,11 +386,11 class ProcUnitConf(): | |||
|
386 | 386 | |
|
387 | 387 | def getId(self): |
|
388 | 388 | |
|
389 |
return |
|
|
389 | return self.id | |
|
390 | 390 | |
|
391 | 391 | def getInputId(self): |
|
392 | 392 | |
|
393 |
return |
|
|
393 | return self.inputId | |
|
394 | 394 | |
|
395 | 395 | def getOperationObjList(self): |
|
396 | 396 | |
@@ -478,7 +478,10 class ProcUnitConf(): | |||
|
478 | 478 | self.name = upElement.get('name') |
|
479 | 479 | self.datatype = upElement.get('datatype') |
|
480 | 480 | self.inputId = upElement.get('inputId') |
|
481 |
|
|
|
481 | ||
|
482 | if self.inputId == 'None': | |
|
483 | self.inputId = '0' | |
|
484 | ||
|
482 | 485 | self.opConfObjList = [] |
|
483 | 486 | |
|
484 | 487 | opElementList = upElement.getiterator(OperationConf().getElementName()) |
@@ -568,7 +571,9 class ReadUnitConf(ProcUnitConf): | |||
|
568 | 571 | self.id = None |
|
569 | 572 | self.datatype = None |
|
570 | 573 | self.name = None |
|
571 |
self.inputId = |
|
|
574 | self.inputId = None | |
|
575 | ||
|
576 | self.parentId = None | |
|
572 | 577 | |
|
573 | 578 | self.opConfObjList = [] |
|
574 | 579 | self.opObjList = [] |
@@ -589,17 +594,33 class ReadUnitConf(ProcUnitConf): | |||
|
589 | 594 | self.startTime = startTime |
|
590 | 595 | self.endTime = endTime |
|
591 | 596 | |
|
597 | self.inputId = '0' | |
|
598 | self.parentId = parentId | |
|
599 | ||
|
592 | 600 | self.addRunOperation(**kwargs) |
|
593 | 601 | |
|
594 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, **kwargs): | |
|
602 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, name=None, **kwargs): | |
|
603 | ||
|
604 | if name==None: | |
|
605 | if 'Reader' in datatype: | |
|
606 | name = datatype | |
|
607 | else: | |
|
608 | name = '%sReader' %(datatype) | |
|
595 | 609 | |
|
610 | if datatype==None: | |
|
611 | datatype = name.replace('Reader','') | |
|
612 | ||
|
596 | 613 | self.datatype = datatype |
|
614 | self.name = name | |
|
597 | 615 | self.path = path |
|
598 | 616 | self.startDate = startDate |
|
599 | 617 | self.endDate = endDate |
|
600 | 618 | self.startTime = startTime |
|
601 | 619 | self.endTime = endTime |
|
602 | 620 | |
|
621 | self.inputId = None | |
|
622 | self.parentId = parentId | |
|
623 | ||
|
603 | 624 | self.updateRunOperation(**kwargs) |
|
604 | 625 | |
|
605 | 626 | def addRunOperation(self, **kwargs): |
@@ -703,16 +724,16 class Project(): | |||
|
703 | 724 | if datatype==None: |
|
704 | 725 | datatype = name.replace('Reader','') |
|
705 | 726 | |
|
706 | id = self.__getNewId() | |
|
727 | idReadUnit = self.__getNewId() | |
|
707 | 728 | |
|
708 | 729 | readUnitConfObj = ReadUnitConf() |
|
709 | readUnitConfObj.setup(id, name, datatype, parentId=self.id, **kwargs) | |
|
730 | readUnitConfObj.setup(idReadUnit, name, datatype, parentId=self.id, **kwargs) | |
|
710 | 731 | |
|
711 | 732 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
712 | 733 | |
|
713 | 734 | return readUnitConfObj |
|
714 | 735 | |
|
715 | def addProcUnit(self, inputId=0, datatype=None, name=None): | |
|
736 | def addProcUnit(self, inputId='0', datatype=None, name=None): | |
|
716 | 737 | |
|
717 | 738 | #Compatible with old signal chain version |
|
718 | 739 | if datatype==None and name==None: |
@@ -727,10 +748,10 class Project(): | |||
|
727 | 748 | if datatype==None: |
|
728 | 749 | datatype = name.replace('Proc','') |
|
729 | 750 | |
|
730 | id = self.__getNewId() | |
|
751 | idProcUnit = self.__getNewId() | |
|
731 | 752 | |
|
732 | 753 | procUnitConfObj = ProcUnitConf() |
|
733 | procUnitConfObj.setup(id, name, datatype, inputId, parentId=self.id) | |
|
754 | procUnitConfObj.setup(idProcUnit, name, datatype, inputId, parentId=self.id) | |
|
734 | 755 | |
|
735 | 756 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
736 | 757 | |
@@ -811,6 +832,9 class Project(): | |||
|
811 | 832 | readUnitConfObj = ReadUnitConf() |
|
812 | 833 | readUnitConfObj.readXml(readUnitElement) |
|
813 | 834 | |
|
835 | if readUnitConfObj.parentId == None: | |
|
836 | readUnitConfObj.parentId = self.id | |
|
837 | ||
|
814 | 838 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
815 | 839 | |
|
816 | 840 | procUnitElementList = self.projectElement.getiterator(ProcUnitConf().getElementName()) |
@@ -819,6 +843,9 class Project(): | |||
|
819 | 843 | procUnitConfObj = ProcUnitConf() |
|
820 | 844 | procUnitConfObj.readXml(procUnitElement) |
|
821 | 845 | |
|
846 | if procUnitConfObj.parentId == None: | |
|
847 | procUnitConfObj.parentId = self.id | |
|
848 | ||
|
822 | 849 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
823 | 850 | |
|
824 | 851 | def printattr(self): |
This diff has been collapsed as it changes many lines, (1094 lines changed) Show them Hide them | |||
@@ -6,7 +6,13 Module implementing MainWindow. | |||
|
6 | 6 | """ |
|
7 | 7 | import os, sys, time |
|
8 | 8 | import datetime |
|
9 | import numpy | |
|
9 | 10 | import Queue |
|
11 | ||
|
12 | from collections import OrderedDict | |
|
13 | from os.path import expanduser | |
|
14 | from time import sleep | |
|
15 | ||
|
10 | 16 | from PyQt4.QtGui import QMainWindow |
|
11 | 17 | from PyQt4.QtCore import pyqtSignature |
|
12 | 18 | from PyQt4.QtCore import pyqtSignal |
@@ -18,19 +24,11 from schainpy.gui.viewer.ui_ftp import Ui_Ftp | |||
|
18 | 24 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow |
|
19 | 25 | from schainpy.controller import Project |
|
20 | 26 | |
|
21 |
from |
|
|
22 | from collections import OrderedDict | |
|
23 | from os.path import expanduser | |
|
24 | #from CodeWarrior.Standard_Suite import file | |
|
25 | from comm import * | |
|
27 | from propertiesViewModel import TreeModel, PropertyBuffer | |
|
28 | from parametersModel import ProjectParms | |
|
26 | 29 | |
|
27 | try: | |
|
28 | from gevent import sleep | |
|
29 | except: | |
|
30 | from time import sleep | |
|
31 | ||
|
32 | 30 | from schainpy.gui.figures import tools |
|
33 | import numpy | |
|
31 | from schainpy.gui.viewcontroller.comm import ControllerThread | |
|
34 | 32 | |
|
35 | 33 | FIGURES_PATH = tools.get_path() |
|
36 | 34 | |
@@ -52,7 +50,7 def isRadarPath(path): | |||
|
52 | 50 | return 0 |
|
53 | 51 | |
|
54 | 52 | return 1 |
|
55 | ||
|
53 | ||
|
56 | 54 | class BasicWindow(QMainWindow, Ui_BasicWindow): |
|
57 | 55 | """ |
|
58 | 56 | """ |
@@ -84,7 +82,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
84 | 82 | self.walk = 0 |
|
85 | 83 | self.create = False |
|
86 | 84 | self.selectedItemTree = None |
|
87 |
self.co |
|
|
85 | self.controllerObj = None | |
|
86 | # self.commCtrlPThread = None | |
|
88 | 87 | # self.create_figure() |
|
89 | 88 | self.temporalFTP = ftpBuffer() |
|
90 | 89 | self.projectProperCaracteristica = [] |
@@ -110,7 +109,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
110 | 109 | self.__ftpProcUnitId = None |
|
111 | 110 | self.__initialized = False |
|
112 | 111 | |
|
113 | self.create_comm() | |
|
112 | # self.create_comm() | |
|
114 | 113 | self.create_updating_timer() |
|
115 | 114 | self.setParameter() |
|
116 | 115 | |
@@ -263,13 +262,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
263 | 262 | Voltage or Spectra |
|
264 | 263 | """ |
|
265 | 264 | if index == 0: |
|
266 |
|
|
|
265 | extension = '.r' | |
|
267 | 266 | elif index == 1: |
|
268 |
|
|
|
267 | extension = '.pdata' | |
|
269 | 268 | elif index == 2: |
|
270 |
|
|
|
271 | ||
|
272 | self.proDataType.setText(self.datatype) | |
|
269 | extension = '.fits' | |
|
270 | elif index == 3: | |
|
271 | extension = '.hdf5' | |
|
272 | ||
|
273 | self.proDataType.setText(extension) | |
|
273 | 274 | self.console.clear() |
|
274 | 275 | |
|
275 | 276 | @pyqtSignature("int") |
@@ -304,30 +305,36 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
304 | 305 | |
|
305 | 306 | @pyqtSignature("") |
|
306 | 307 | def on_proLoadButton_clicked(self): |
|
308 | ||
|
307 | 309 | self.console.clear() |
|
308 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk , set = self.checkInputsProject() | |
|
309 | if read_mode == "Offline": | |
|
310 | if parms_ok: | |
|
311 | self.proComStartDate.clear() | |
|
312 | self.proComEndDate.clear() | |
|
313 | self.loadDays(data_path, ext, walk) | |
|
314 | self.proComStartDate.setEnabled(True) | |
|
315 | self.proComEndDate.setEnabled(True) | |
|
316 | self.proStartTime.setEnabled(True) | |
|
317 | self.proEndTime.setEnabled(True) | |
|
318 | self.frame_2.setEnabled(True) | |
|
310 | ||
|
311 | parameter_list = self.checkInputsProject() | |
|
312 | ||
|
313 | if not parameter_list[0]: | |
|
319 | 314 | return |
|
315 | ||
|
316 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set = parameter_list | |
|
317 | ||
|
318 | if read_mode == "Offline": | |
|
319 | self.proComStartDate.clear() | |
|
320 | self.proComEndDate.clear() | |
|
321 | self.proComStartDate.setEnabled(True) | |
|
322 | self.proComEndDate.setEnabled(True) | |
|
323 | self.proStartTime.setEnabled(True) | |
|
324 | self.proEndTime.setEnabled(True) | |
|
325 | self.frame_2.setEnabled(True) | |
|
326 | ||
|
320 | 327 | if read_mode == "Online": |
|
321 | if parms_ok: | |
|
322 |
|
|
|
323 |
|
|
|
324 | self.loadDays(data_path, ext, walk) | |
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 | self.proEndTime.setEnabled(False) | |
|
329 | self.frame_2.setEnabled(True) | |
|
330 | ||
|
328 | self.proComStartDate.addItem("2000/01/30") | |
|
329 | self.proComEndDate.addItem("2016/12/31") | |
|
330 | self.proComStartDate.setEnabled(False) | |
|
331 | self.proComEndDate.setEnabled(False) | |
|
332 | self.proStartTime.setEnabled(False) | |
|
333 | self.proEndTime.setEnabled(False) | |
|
334 | self.frame_2.setEnabled(True) | |
|
335 | ||
|
336 | self.loadDays(data_path, ext, walk) | |
|
337 | ||
|
331 | 338 | @pyqtSignature("int") |
|
332 | 339 | def on_proComStartDate_activated(self, index): |
|
333 | 340 | """ |
@@ -371,7 +378,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
371 | 378 | |
|
372 | 379 | self.__itemTreeDict[projectId].setText(projectObjView.name) |
|
373 | 380 | # Project Properties |
|
374 |
self.sh |
|
|
381 | self.refreshProjectProperties(projectObjView) | |
|
375 | 382 | # Disable tabProject after finish the creation |
|
376 | 383 | self.tabProject.setEnabled(True) |
|
377 | 384 | |
@@ -496,9 +503,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
496 | 503 | |
|
497 | 504 | @pyqtSignature("") |
|
498 | 505 | def on_specHeisOutputMetadaToolPath_clicked(self): |
|
499 | home = expanduser("~") | |
|
500 | self.dir = os.path.join(home, 'schain_workspace') | |
|
501 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.dir, self.tr("Text Files (*.xml)"))) | |
|
506 | ||
|
507 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) | |
|
502 | 508 | self.specHeisOutputMetada.setText(filename) |
|
503 | 509 | |
|
504 | 510 | @pyqtSignature("") |
@@ -513,11 +519,11 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
513 | 519 | self.actionSaveToolbar.setEnabled(False) |
|
514 | 520 | self.actionStarToolbar.setEnabled(False) |
|
515 | 521 | |
|
516 |
puObj = self.getSelected |
|
|
522 | puObj = self.getSelectedItemObj() | |
|
517 | 523 | puObj.removeOperations() |
|
518 | 524 | |
|
519 | 525 | if self.volOpCebRadarfrequency.isChecked(): |
|
520 | value = self.volOpRadarfrequency.text() | |
|
526 | value = str(self.volOpRadarfrequency.text()) | |
|
521 | 527 | format = 'float' |
|
522 | 528 | name_operation = 'setRadarFrequency' |
|
523 | 529 | name_parameter = 'frequency' |
@@ -530,8 +536,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
530 | 536 | return 0 |
|
531 | 537 | opObj = puObj.addOperation(name=name_operation) |
|
532 | 538 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
533 | ||
|
534 | ||
|
535 | 539 | |
|
536 | 540 | if self.volOpCebChannels.isChecked(): |
|
537 | 541 | value = str(self.volOpChannel.text()) |
@@ -680,17 +684,18 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
680 | 684 | if self.volOpCebFlip.isChecked(): |
|
681 | 685 | name_operation = 'deFlip' |
|
682 | 686 | optype = 'self' |
|
683 | value = self.volOpFlip.text() | |
|
687 | value = str(self.volOpFlip.text()) | |
|
684 | 688 | name_parameter = 'channelList' |
|
685 | 689 | format = 'intlist' |
|
686 | 690 | |
|
687 | 691 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
688 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
|
692 | if value: | |
|
693 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
|
689 | 694 | |
|
690 | 695 | if self.volOpCebCohInt.isChecked(): |
|
691 | 696 | name_operation = 'CohInt' |
|
692 | 697 | optype = 'other' |
|
693 | value = self.volOpCohInt.text() | |
|
698 | value = str(self.volOpCohInt.text()) | |
|
694 | 699 | name_parameter = 'n' |
|
695 | 700 | format = 'float' |
|
696 | 701 | |
@@ -716,9 +721,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
716 | 721 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
717 | 722 | opObj.addParameter(name=name_parameter1, value=value1, format=format1) |
|
718 | 723 | |
|
719 | channelList = self.volGraphChannelList.text() | |
|
720 |
xvalue = self.volGraphfreqrange.text() |
|
|
721 | yvalue = self.volGraphHeightrange.text() | |
|
724 | channelList = str(self.volGraphChannelList.text()) | |
|
725 | xvalue = str(self.volGraphfreqrange.text()) | |
|
726 | yvalue = str(self.volGraphHeightrange.text()) | |
|
722 | 727 | |
|
723 | 728 | if self.volGraphChannelList.isModified(): |
|
724 | 729 | try: |
@@ -752,7 +757,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
752 | 757 | checkPath = True |
|
753 | 758 | opObj.addParameter(name='save', value='1', format='int') |
|
754 | 759 | opObj.addParameter(name='figpath', value=self.volGraphPath.text(), format='str') |
|
755 | value = self.volGraphPrefix.text() | |
|
760 | value = str(self.volGraphPrefix.text()) | |
|
756 | 761 | if not value == "": |
|
757 | 762 | try: |
|
758 | 763 | value = str(self.volGraphPrefix.text()) |
@@ -788,7 +793,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
788 | 793 | opObj.addParameter(name=name_parameter3, value=value3, format=format) |
|
789 | 794 | |
|
790 | 795 | #---------NEW VOLTAGE PROPERTIES |
|
791 |
self.sh |
|
|
796 | self.refreshPUProperties(puObj) | |
|
792 | 797 | |
|
793 | 798 | self.console.clear() |
|
794 | 799 | self.console.append("If you want to save your project") |
@@ -1067,7 +1072,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1067 | 1072 | self.actionSaveToolbar.setEnabled(False) |
|
1068 | 1073 | self.actionStarToolbar.setEnabled(False) |
|
1069 | 1074 | |
|
1070 |
p |
|
|
1075 | projectObj = self.getSelectedProjectObj() | |
|
1076 | puObj = self.getSelectedItemObj() | |
|
1077 | ||
|
1071 | 1078 | puObj.removeOperations() |
|
1072 | 1079 | |
|
1073 | 1080 | if self.specOpCebRadarfrequency.isChecked(): |
@@ -1085,37 +1092,31 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1085 | 1092 | opObj = puObj.addOperation(name=name_operation) |
|
1086 | 1093 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
1087 | 1094 | |
|
1088 | ||
|
1089 | if self.proComDataType.currentText() == 'Voltage': | |
|
1090 | name_parameter = 'nFFTPoints' | |
|
1091 | value = self.specOpnFFTpoints.text() | |
|
1092 | name_parameter1 = 'nProfiles' | |
|
1093 | value1 = self.specOpProfiles.text() | |
|
1094 | name_parameter2 = 'ippFactor' | |
|
1095 | value2 = self.specOpippFactor.text() | |
|
1096 | format = 'int' | |
|
1095 | inputId = puObj.getInputId() | |
|
1096 | inputPuObj = projectObj.getProcUnitObj(inputId) | |
|
1097 | ||
|
1098 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': | |
|
1099 | ||
|
1097 | 1100 | try: |
|
1098 | 1101 | value = int(self.specOpnFFTpoints.text()) |
|
1102 | puObj.addParameter(name='nFFTPoints', value=value, format='int') | |
|
1099 | 1103 | except: |
|
1100 | 1104 | self.console.clear() |
|
1101 |
self.console.append("Please |
|
|
1105 | self.console.append("Please write the number of FFT") | |
|
1102 | 1106 | return 0 |
|
1103 | puObj.addParameter(name=name_parameter, value=value, format=format) | |
|
1104 |
|
|
|
1105 | try: | |
|
1106 | value1 = int(self.specOpProfiles.text()) | |
|
1107 |
|
|
|
1108 |
|
|
|
1109 | self.console.append("Please Write the number of Profiles") | |
|
1110 |
|
|
|
1111 | puObj.addParameter(name=name_parameter1, value=value1, format=format) | |
|
1112 | if not value2 == "": | |
|
1113 |
|
|
|
1114 | value2 = int(self.specOpippFactor.text()) | |
|
1115 |
|
|
|
1116 | self.console.clear() | |
|
1117 | self.console.append("Please Write the Number of IppFactor") | |
|
1118 | puObj.addParameter(name=name_parameter2 , value=value2 , format=format) | |
|
1107 | ||
|
1108 | try: | |
|
1109 | value1 = int(self.specOpProfiles.text()) | |
|
1110 | puObj.addParameter(name='nProfiles', value=value1, format='int') | |
|
1111 | except: | |
|
1112 | self.console.append("Please Write the number of Profiles") | |
|
1113 | ||
|
1114 | try: | |
|
1115 | value2 = int(self.specOpippFactor.text()) | |
|
1116 | puObj.addParameter(name='ippFactor' , value=value2 , format='int') | |
|
1117 | except: | |
|
1118 | self.console.append("Please Write the Number of IppFactor") | |
|
1119 | ||
|
1119 | 1120 | |
|
1120 | 1121 | if self.specOpCebCrossSpectra.isChecked(): |
|
1121 | 1122 | name_parameter = 'pairsList' |
@@ -1811,7 +1812,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1811 | 1812 | opObj.addParameter(name=name_parameter2, value=value2, format=format) |
|
1812 | 1813 | opObj.addParameter(name=name_parameter3, value=value3, format=format) |
|
1813 | 1814 | |
|
1814 |
self.sh |
|
|
1815 | self.refreshPUProperties(puObj) | |
|
1815 | 1816 | |
|
1816 | 1817 | self.console.clear() |
|
1817 | 1818 | self.console.append("If you want to save your project") |
@@ -2065,7 +2066,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2065 | 2066 | self.actionSaveToolbar.setEnabled(False) |
|
2066 | 2067 | self.actionStarToolbar.setEnabled(False) |
|
2067 | 2068 | |
|
2068 |
puObj = self.getSelected |
|
|
2069 | puObj = self.getSelectedItemObj() | |
|
2069 | 2070 | puObj.removeOperations() |
|
2070 | 2071 | |
|
2071 | 2072 | if self.specHeisOpCebIncoherent.isChecked(): |
@@ -2289,7 +2290,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2289 | 2290 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2290 | 2291 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) |
|
2291 | 2292 | |
|
2292 |
self. |
|
|
2293 | self.refreshPUProperties(puObj) | |
|
2293 | 2294 | |
|
2294 | 2295 | self.console.clear() |
|
2295 | 2296 | self.console.append("Click on save icon ff you want to save your project") |
@@ -2361,63 +2362,341 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2361 | 2362 | @pyqtSignature("") |
|
2362 | 2363 | def on_specHeisGraphClear_clicked(self): |
|
2363 | 2364 | pass |
|
2365 | ||
|
2366 | def __getParmsFromProjectWindow(self): | |
|
2367 | """ | |
|
2368 | Check Inputs Project: | |
|
2369 | - project_name | |
|
2370 | - datatype | |
|
2371 | - ext | |
|
2372 | - data_path | |
|
2373 | - readmode | |
|
2374 | - delay | |
|
2375 | - set | |
|
2376 | - walk | |
|
2377 | """ | |
|
2378 | parms_ok = True | |
|
2379 | ||
|
2380 | project_name = str(self.proName.text()) | |
|
2381 | ||
|
2382 | if project_name == '' or project_name == None: | |
|
2383 | outputstr = "Enter a project Name" | |
|
2384 | self.console.append(outputstr) | |
|
2385 | parms_ok = False | |
|
2386 | project_name = None | |
|
2387 | ||
|
2388 | datatype = str(self.proComDataType.currentText()) | |
|
2389 | ext = str(self.proDataType.text()) | |
|
2390 | ||
|
2391 | dpath = str(self.proDataPath.text()) | |
|
2392 | ||
|
2393 | if dpath == '': | |
|
2394 | outputstr = 'Datapath is empty' | |
|
2395 | self.console.append(outputstr) | |
|
2396 | parms_ok = False | |
|
2397 | dpath = None | |
|
2398 | ||
|
2399 | if dpath != None: | |
|
2400 | if not os.path.isdir(dpath): | |
|
2401 | outputstr = 'Datapath (%s) does not exist' % dpath | |
|
2402 | self.console.append(outputstr) | |
|
2403 | parms_ok = False | |
|
2404 | dpath = None | |
|
2405 | ||
|
2406 | online = str(self.proComReadMode.currentIndex()) | |
|
2407 | ||
|
2408 | delay = None | |
|
2409 | if online==1: | |
|
2410 | try: | |
|
2411 | delay = int(str(self.proDelay.text())) | |
|
2412 | except: | |
|
2413 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proName.text()) | |
|
2414 | self.console.append(outputstr) | |
|
2415 | parms_ok = False | |
|
2416 | ||
|
2417 | ||
|
2418 | set = None | |
|
2419 | ippKm = None | |
|
2420 | ||
|
2421 | value = str(self.proSet.text()) | |
|
2422 | ||
|
2423 | if datatype.lower() == "usrp": | |
|
2424 | try: | |
|
2425 | ippKm = float(value) | |
|
2426 | except: | |
|
2427 | outputstr = 'IPP value (%s) must be a float number' % str(self.proName.text()) | |
|
2428 | self.console.append(outputstr) | |
|
2429 | parms_ok = False | |
|
2430 | else: | |
|
2431 | try: | |
|
2432 | set = int(value) | |
|
2433 | except: | |
|
2434 | pass | |
|
2435 | ||
|
2436 | walk = self.proComWalk.currentIndex() | |
|
2437 | ||
|
2438 | starDate = str(self.proComStartDate.currentText()) | |
|
2439 | endDate = str(self.proComEndDate.currentText()) | |
|
2440 | ||
|
2441 | # startDateList = starDate.split("/") | |
|
2442 | # endDateList = endDate.split("/") | |
|
2443 | # | |
|
2444 | # starDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) | |
|
2445 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) | |
|
2446 | ||
|
2447 | startTime = self.proStartTime.time() | |
|
2448 | endTime = self.proEndTime.time() | |
|
2449 | ||
|
2450 | startTime = startTime.strftime("%H:%M:%S") | |
|
2451 | endTime = endTime.strftime("%H:%M:%S") | |
|
2452 | ||
|
2453 | projectParms = ProjectParms() | |
|
2454 | ||
|
2455 | projectParms.project_name = project_name | |
|
2456 | projectParms.datatype = datatype | |
|
2457 | projectParms.ext = ext | |
|
2458 | projectParms.dpath = dpath | |
|
2459 | projectParms.online = online | |
|
2460 | projectParms.startDate = startDate | |
|
2461 | projectParms.endDate = endDate | |
|
2462 | projectParms.startTime = startTime | |
|
2463 | projectParms.endTime = endTime | |
|
2464 | projectParms.delay=delay | |
|
2465 | projectParms.walk=walk | |
|
2466 | projectParms.set=set | |
|
2467 | projectParms.ippKm=ippKm | |
|
2468 | projectParms.parmsOk=parms_ok | |
|
2469 | ||
|
2470 | return projectParms | |
|
2471 | ||
|
2472 | ||
|
2473 | def __getParmsFromProjectObj(self, projectObjView): | |
|
2474 | ||
|
2475 | parms_ok = True | |
|
2476 | ||
|
2477 | project_name, description = projectObjView.name, projectObjView.description | |
|
2478 | ||
|
2479 | readUnitObj = projectObjView.getReadUnitObj() | |
|
2480 | datatype = readUnitObj.datatype | |
|
2481 | ||
|
2482 | operationObj = readUnitObj.getOperationObj(name='run') | |
|
2483 | ||
|
2484 | dpath = operationObj.getParameterValue(parameterName='path') | |
|
2485 | startDate = operationObj.getParameterValue(parameterName='startDate') | |
|
2486 | endDate = operationObj.getParameterValue(parameterName='endDate') | |
|
2487 | ||
|
2488 | startDate = startDate.strftime("%Y/%m/%d") | |
|
2489 | endDate = endDate.strftime("%Y/%m/%d") | |
|
2490 | ||
|
2491 | startTime = operationObj.getParameterValue(parameterName='startTime') | |
|
2492 | endTime = operationObj.getParameterValue(parameterName='endTime') | |
|
2493 | ||
|
2494 | startTime = startTime.strftime("%H:%M:%S") | |
|
2495 | endTime = endTime.strftime("%H:%M:%S") | |
|
2496 | ||
|
2497 | online = 0 | |
|
2498 | try: | |
|
2499 | online = operationObj.getParameterValue(parameterName='online') | |
|
2500 | except: | |
|
2501 | pass | |
|
2502 | ||
|
2503 | delay = '' | |
|
2504 | try: | |
|
2505 | delay = operationObj.getParameterValue(parameterName='delay') | |
|
2506 | except: | |
|
2507 | pass | |
|
2508 | ||
|
2509 | walk = 0 | |
|
2510 | try: | |
|
2511 | walk = operationObj.getParameterValue(parameterName='walk') | |
|
2512 | except: | |
|
2513 | pass | |
|
2514 | ||
|
2515 | set = '' | |
|
2516 | try: | |
|
2517 | set = operationObj.getParameterValue(parameterName='set') | |
|
2518 | except: | |
|
2519 | pass | |
|
2520 | ||
|
2521 | ippKm = '' | |
|
2522 | if datatype.lower() == 'usrp': | |
|
2523 | try: | |
|
2524 | ippKm = operationObj.getParameterValue(parameterName='ippKm') | |
|
2525 | except: | |
|
2526 | pass | |
|
2527 | ||
|
2528 | projectParms = ProjectParms() | |
|
2529 | ||
|
2530 | projectParms.project_name = project_name | |
|
2531 | projectParms.datatype = datatype | |
|
2532 | projectParms.ext = None | |
|
2533 | projectParms.dpath = dpath | |
|
2534 | projectParms.online = online | |
|
2535 | projectParms.startDate = startDate | |
|
2536 | projectParms.endDate = endDate | |
|
2537 | projectParms.startTime = startTime | |
|
2538 | projectParms.endTime = endTime | |
|
2539 | projectParms.delay=delay | |
|
2540 | projectParms.walk=walk | |
|
2541 | projectParms.set=set | |
|
2542 | projectParms.ippKm=ippKm | |
|
2543 | projectParms.parmsOk=parms_ok | |
|
2544 | ||
|
2545 | return projectParms | |
|
2546 | ||
|
2547 | def refreshProjectWindow2(self, projectObjView): | |
|
2548 | ||
|
2549 | projectParms = self.__getParmsFromProjectObj(projectObjView) | |
|
2550 | ||
|
2551 | index = projectParms.getDatatypeIndex() | |
|
2552 | ||
|
2553 | self.proName.setText(projectObjView.name) | |
|
2554 | self.proDescription.clear() | |
|
2555 | self.proDescription.append(projectObjView.description) | |
|
2556 | ||
|
2557 | self.on_proComDataType_activated(index=index) | |
|
2558 | self.proDataType.setText(projectParms.getExt()) | |
|
2559 | self.proDataPath.setText(projectParms.dpath) | |
|
2560 | self.proComDataType.setCurrentIndex(index) | |
|
2561 | self.proComReadMode.setCurrentIndex(projectParms.online) | |
|
2562 | self.proDelay.setText(str(projectParms.delay)) | |
|
2563 | self.proSet.setText(str(projectParms.set)) | |
|
2564 | ||
|
2565 | dateList = self.loadDays(data_path = projectParms.dpath, | |
|
2566 | ext = projectParms.getExt(), | |
|
2567 | walk = projectParms.walk, | |
|
2568 | expLabel = projectParms.expLabel) | |
|
2569 | ||
|
2570 | try: | |
|
2571 | startDateIndex = dateList.index(projectParms.startDate) | |
|
2572 | except: | |
|
2573 | startDateIndex = 0 | |
|
2574 | ||
|
2575 | try: | |
|
2576 | endDateIndex = dateList.index(projectParms.endDate) | |
|
2577 | except: | |
|
2578 | endDateIndex = -1 | |
|
2579 | ||
|
2580 | self.proComStartDate.setCurrentIndex(startDateIndex) | |
|
2581 | self.proComEndDate.setCurrentIndex(endDateIndex) | |
|
2582 | ||
|
2583 | startlist = projectParms.startTime.split(":") | |
|
2584 | endlist = projectParms.endTime.split(":") | |
|
2585 | ||
|
2586 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) | |
|
2587 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) | |
|
2588 | ||
|
2589 | self.proStartTime.setTime(self.time) | |
|
2590 | self.proEndTime.setTime(self.time) | |
|
2591 | ||
|
2592 | def refreshProjectProperties(self, projectObjView): | |
|
2593 | ||
|
2594 | propertyBuffObj = PropertyBuffer() | |
|
2595 | name = projectObjView.name | |
|
2596 | ||
|
2597 | propertyBuffObj.append("Properties", "Name", projectObjView.name), | |
|
2598 | propertyBuffObj.append("Properties", "Description", projectObjView.description) | |
|
2599 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) | |
|
2600 | ||
|
2601 | readUnitObj = projectObjView.getReadUnitObj() | |
|
2602 | runOperationObj = readUnitObj.getOperationObj(name='run') | |
|
2603 | ||
|
2604 | for thisParmObj in runOperationObj.getParameterObjList(): | |
|
2605 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) | |
|
2606 | ||
|
2607 | propertiesModel = propertyBuffObj.getPropertyModel() | |
|
2608 | ||
|
2609 | self.treeProjectProperties.setModel(propertiesModel) | |
|
2610 | self.treeProjectProperties.expandAll() | |
|
2611 | self.treeProjectProperties.resizeColumnToContents(0) | |
|
2612 | self.treeProjectProperties.resizeColumnToContents(1) | |
|
2613 | ||
|
2614 | def refreshPUProperties(self, puObjView): | |
|
2615 | ||
|
2616 | propertyBuffObj = PropertyBuffer() | |
|
2617 | ||
|
2618 | for thisOp in puObjView.getOperationObjList(): | |
|
2619 | ||
|
2620 | operationName = thisOp.name | |
|
2621 | if operationName == 'run': | |
|
2622 | operationName = 'Properties' | |
|
2623 | else: | |
|
2624 | if not thisOp.getParameterObjList(): | |
|
2625 | propertyBuffObj.append(operationName, '--', '--') | |
|
2364 | 2626 | |
|
2627 | for thisParmObj in thisOp.getParameterObjList(): | |
|
2628 | ||
|
2629 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) | |
|
2630 | ||
|
2631 | propertiesModel = propertyBuffObj.getPropertyModel() | |
|
2632 | ||
|
2633 | self.treeProjectProperties.setModel(propertiesModel) | |
|
2634 | self.treeProjectProperties.expandAll() | |
|
2635 | self.treeProjectProperties.resizeColumnToContents(0) | |
|
2636 | self.treeProjectProperties.resizeColumnToContents(1) | |
|
2637 | ||
|
2365 | 2638 | def on_click(self, index): |
|
2366 | 2639 | |
|
2367 | 2640 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) |
|
2368 | if self.getSelectedProjectObj(): | |
|
2369 |
|
|
|
2370 | project_name, description = projectObjView.name, projectObjView.description | |
|
2371 |
|
|
|
2372 | idReadUnit = projectObjView.getReadUnitId() | |
|
2373 | readUnitObj = projectObjView.getProcUnitObj(idReadUnit) | |
|
2374 | datatype, data_path, startDate, endDate, startTime, endTime , online , delay, walk , set = self.showProjectProperties(projectObjView) | |
|
2375 | # show ProjectView | |
|
2376 | self.refreshProjectWindow(project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, set) | |
|
2377 | if datatype == 'Voltage': | |
|
2378 | ext = '.r' | |
|
2379 | elif datatype == 'Spectra': | |
|
2380 | ext = '.pdata' | |
|
2381 | elif datatype == 'Fits': | |
|
2382 | ext = '.fits' | |
|
2383 | if online == 0: | |
|
2384 | self.proComStartDate.clear() | |
|
2385 | self.proComEndDate.clear() | |
|
2386 | self.loadDays(data_path, ext, walk) | |
|
2641 | ||
|
2642 | projectObjView = self.getSelectedProjectObj() | |
|
2643 | ||
|
2644 | if not projectObjView: | |
|
2645 | return | |
|
2646 | ||
|
2647 | #A project has been selected | |
|
2648 | if projectObjView == self.getSelectedItemObj(): | |
|
2649 | ||
|
2650 | self.refreshProjectWindow2(projectObjView) | |
|
2651 | self.refreshProjectProperties(projectObjView) | |
|
2652 | ||
|
2387 | 2653 | self.tabProject.setEnabled(True) |
|
2388 | 2654 | self.tabVoltage.setEnabled(False) |
|
2389 | 2655 | self.tabSpectra.setEnabled(False) |
|
2390 | 2656 | self.tabCorrelation.setEnabled(False) |
|
2391 | 2657 | self.tabSpectraHeis.setEnabled(False) |
|
2392 |
self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
|
2393 | ||
|
2658 | self.tabWidgetProject.setCurrentWidget(self.tabProject) | |
|
2659 | ||
|
2660 | return | |
|
2661 | ||
|
2662 | #A processing unit has been selected | |
|
2663 | voltEnable = False | |
|
2664 | specEnable = False | |
|
2665 | corrEnable = False | |
|
2666 | specHeisEnable = False | |
|
2667 | tabSelected = self.tabProject | |
|
2668 | ||
|
2669 | puObj = self.getSelectedItemObj() | |
|
2670 | inputId = puObj.getInputId() | |
|
2671 | inputPUObj = projectObjView.getProcUnitObj(inputId) | |
|
2672 | ||
|
2394 | 2673 | if self.selectedItemTree.text() == 'Voltage': |
|
2395 | 2674 | datatype = 'Voltage' |
|
2396 | puObj = self.getSelectedPUObj() | |
|
2397 | self.showtabPUCreated(datatype=datatype) | |
|
2675 | ||
|
2398 | 2676 | if len(puObj.getOperationObjList()) == 1: |
|
2399 |
self. |
|
|
2677 | self.clearPUWindow(datatype) | |
|
2400 | 2678 | else: |
|
2401 | 2679 | self.refreshPUWindow(datatype=datatype, puObj=puObj) |
|
2402 |
self.sh |
|
|
2680 | self.refreshPUProperties(puObj) | |
|
2681 | ||
|
2682 | voltEnable = True | |
|
2683 | tabSelected = self.tabVoltage | |
|
2403 | 2684 | |
|
2404 | 2685 | if self.selectedItemTree.text() == 'Spectra': |
|
2405 | 2686 | |
|
2406 | 2687 | datatype = 'Spectra' |
|
2407 | puObj = self.getSelectedPUObj() | |
|
2408 | self.showtabPUCreated(datatype=datatype) | |
|
2409 | if readUnitObj.datatype == 'Spectra': | |
|
2688 | ||
|
2689 | if inputPUObj.datatype == 'Spectra': | |
|
2410 | 2690 | self.specOpnFFTpoints.setEnabled(False) |
|
2411 | 2691 | self.specOpProfiles.setEnabled(False) |
|
2412 | 2692 | self.specOpippFactor.setEnabled(False) |
|
2413 | ||
|
2414 | 2693 | else: |
|
2415 | 2694 | self.specOpnFFTpoints.setEnabled(True) |
|
2416 | 2695 | self.specOpProfiles.setEnabled(True) |
|
2417 | 2696 | self.specOpippFactor.setEnabled(True) |
|
2418 | 2697 | |
|
2419 | 2698 | if len(puObj.getOperationObjList()) == 1: |
|
2420 |
self. |
|
|
2699 | self.clearPUWindow(datatype) | |
|
2421 | 2700 | |
|
2422 | 2701 | opObj = puObj.getOperationObj(name="run") |
|
2423 | 2702 | if opObj == None: |
@@ -2464,31 +2743,41 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2464 | 2743 | |
|
2465 | 2744 | else: |
|
2466 | 2745 | self.refreshPUWindow(datatype=datatype, puObj=puObj) |
|
2467 |
self.sh |
|
|
2746 | self.refreshPUProperties(puObj) | |
|
2747 | ||
|
2748 | specEnable = True | |
|
2749 | tabSelected = self.tabSpectra | |
|
2468 | 2750 | |
|
2469 | 2751 | if self.selectedItemTree.text() == 'Correlation': |
|
2470 | self.tabCorrelation.setEnabled(True) | |
|
2471 | self.tabVoltage.setEnabled(False) | |
|
2472 | self.tabSpectra.setEnabled(False) | |
|
2473 | self.tabWidgetProject.setCurrentWidget(self.tabCorrelation) | |
|
2752 | ||
|
2753 | corrEnable = True | |
|
2754 | tabSelected = self.tabCorrelation | |
|
2474 | 2755 | |
|
2475 | 2756 | if self.selectedItemTree.text() == 'SpectraHeis': |
|
2476 | 2757 | datatype = 'SpectraHeis' |
|
2477 | puObj = self.getSelectedPUObj() | |
|
2478 | self.showtabPUCreated(datatype=datatype) | |
|
2758 | ||
|
2479 | 2759 | if len(puObj.getOperationObjList()) == 1: |
|
2480 |
self. |
|
|
2760 | self.clearPUWindow(datatype) | |
|
2481 | 2761 | else: |
|
2482 | 2762 | self.refreshPUWindow(datatype=datatype, puObj=puObj) |
|
2483 |
self. |
|
|
2763 | self.refreshPUProperties(puObj) | |
|
2484 | 2764 | |
|
2765 | specHeisEnable = False | |
|
2766 | tabSelected = self.tabSpectraHeis | |
|
2767 | ||
|
2768 | self.tabProject.setEnabled(False) | |
|
2769 | self.tabVoltage.setEnabled(voltEnable) | |
|
2770 | self.tabSpectra.setEnabled(specEnable) | |
|
2771 | self.tabCorrelation.setEnabled(corrEnable) | |
|
2772 | self.tabSpectraHeis.setEnabled(specHeisEnable) | |
|
2773 | self.tabWidgetProject.setCurrentWidget(tabSelected) | |
|
2485 | 2774 | |
|
2486 | 2775 | def on_right_click(self, pos): |
|
2487 | 2776 | |
|
2488 | 2777 | self.menu = QtGui.QMenu() |
|
2489 |
quitAction0 = self.menu.addAction("Create a |
|
|
2490 |
quitAction1 = self.menu.addAction("Create a |
|
|
2491 |
quitAction2 = self.menu.addAction("Delete |
|
|
2778 | quitAction0 = self.menu.addAction("Create a New Project") | |
|
2779 | quitAction1 = self.menu.addAction("Create a New Processing Unit") | |
|
2780 | quitAction2 = self.menu.addAction("Delete Item") | |
|
2492 | 2781 | quitAction3 = self.menu.addAction("Quit") |
|
2493 | 2782 | |
|
2494 | 2783 | if len(self.__itemTreeDict) == 0: |
@@ -2504,7 +2793,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2504 | 2793 | |
|
2505 | 2794 | if action == quitAction1: |
|
2506 | 2795 | if len(self.__projectObjDict) == 0: |
|
2507 |
outputstr = " |
|
|
2796 | outputstr = "You need to create a Project before adding a Processing Unit" | |
|
2508 | 2797 | self.console.clear() |
|
2509 | 2798 | self.console.append(outputstr) |
|
2510 | 2799 | return 0 |
@@ -2512,23 +2801,23 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2512 | 2801 | self.addPUWindow() |
|
2513 | 2802 | self.console.clear() |
|
2514 | 2803 | self.console.append("Please, Choose the type of Processing Unit") |
|
2515 | self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") | |
|
2516 | self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") | |
|
2517 | self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") | |
|
2804 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") | |
|
2805 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") | |
|
2806 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") | |
|
2518 | 2807 | |
|
2519 | 2808 | if action == quitAction2: |
|
2520 | 2809 | index = self.selectedItemTree |
|
2521 | 2810 | try: |
|
2522 | 2811 | index.parent() |
|
2523 | 2812 | except: |
|
2524 |
self.console.append(' |
|
|
2813 | self.console.append('Please first select a Project or Processing Unit') | |
|
2525 | 2814 | return 0 |
|
2526 | 2815 | # print index.parent(),index |
|
2527 | 2816 | if index.parent() == None: |
|
2528 | 2817 | self.projectExplorerModel.removeRow(index.row()) |
|
2529 | 2818 | else: |
|
2530 | 2819 | index.parent().removeRow(index.row()) |
|
2531 |
self. |
|
|
2820 | self.removeItemTreeFromProject() | |
|
2532 | 2821 | self.console.clear() |
|
2533 | 2822 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): |
|
2534 | 2823 | # print i.row() |
@@ -2548,8 +2837,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2548 | 2837 | ext = '.pdata' |
|
2549 | 2838 | value = 1 |
|
2550 | 2839 | elif datatype == 'Fits': |
|
2551 | ext = 'fits' | |
|
2840 | ext = '.fits' | |
|
2552 | 2841 | value = 2 |
|
2842 | elif datatype == 'USRP': | |
|
2843 | ext = '.hdf5' | |
|
2844 | value = 3 | |
|
2845 | ||
|
2553 | 2846 | self.proDataType.setText(ext) |
|
2554 | 2847 | self.proDataPath.setText(str(data_path)) |
|
2555 | 2848 | self.proComDataType.setCurrentIndex(value) |
@@ -2615,7 +2908,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2615 | 2908 | self.volOpChannel.setText(value) |
|
2616 | 2909 | self.volOpChannel.setEnabled(True) |
|
2617 | 2910 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) |
|
2618 |
self. |
|
|
2911 | self.volOpComChannels.setCurrentIndex(channelMode) | |
|
2619 | 2912 | |
|
2620 | 2913 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2621 | 2914 | if opObj == None: |
@@ -3693,18 +3986,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3693 | 3986 | |
|
3694 | 3987 | def createReadUnitView(self, projectObjView): |
|
3695 | 3988 | |
|
3696 |
project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk |
|
|
3697 | if set == None: | |
|
3698 | readUnitConfObj = projectObjView.addReadUnit(datatype=datatype, | |
|
3699 | path=data_path, | |
|
3700 | startDate=startDate, | |
|
3701 | endDate=endDate, | |
|
3702 | startTime=startTime, | |
|
3703 | endTime=endTime, | |
|
3704 | online=online, | |
|
3705 | delay=delay, | |
|
3706 | walk=walk) | |
|
3707 | else: | |
|
3989 | project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() | |
|
3990 | ||
|
3991 | if datatype == "Voltage" or datatype == "Spectra" or datatype == "Fits": | |
|
3708 | 3992 | readUnitConfObj = projectObjView.addReadUnit(datatype=datatype, |
|
3709 | 3993 | path=data_path, |
|
3710 | 3994 | startDate=startDate, |
@@ -3714,8 +3998,20 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3714 | 3998 | online=online, |
|
3715 | 3999 | delay=delay, |
|
3716 | 4000 | walk=walk, |
|
3717 |
set=set |
|
|
3718 | ||
|
4001 | set=set | |
|
4002 | ) | |
|
4003 | ||
|
4004 | if datatype == "USRP": | |
|
4005 | readUnitConfObj = projectObjView.addReadUnit(datatype=datatype, | |
|
4006 | path=data_path, | |
|
4007 | startDate=startDate, | |
|
4008 | endDate=endDate, | |
|
4009 | startTime=startTime, | |
|
4010 | endTime=endTime, | |
|
4011 | online=online, | |
|
4012 | delay=delay, | |
|
4013 | ippKm=set | |
|
4014 | ) | |
|
3719 | 4015 | return readUnitConfObj |
|
3720 | 4016 | |
|
3721 | 4017 | def updateReadUnitView(self, projectObjView, idReadUnit): |
@@ -3724,8 +4020,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3724 | 4020 | |
|
3725 | 4021 | readUnitConfObj = projectObjView.getProcUnitObj(idReadUnit) |
|
3726 | 4022 | |
|
3727 | if set == None: | |
|
3728 | ||
|
4023 | if datatype == "Voltage" or datatype == "Spectra" or datatype == "Fits": | |
|
3729 | 4024 | readUnitConfObj.update(datatype=datatype, |
|
3730 | 4025 | path=data_path, |
|
3731 | 4026 | startDate=startDate, |
@@ -3734,21 +4029,21 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3734 | 4029 | endTime=endTime, |
|
3735 | 4030 | online=online, |
|
3736 | 4031 | delay=delay, |
|
3737 |
walk=walk |
|
|
3738 | ||
|
3739 | else: | |
|
4032 | walk=walk, | |
|
4033 | set=set | |
|
4034 | ) | |
|
4035 | ||
|
4036 | if datatype == "USRP": | |
|
3740 | 4037 | readUnitConfObj.update(datatype=datatype, |
|
3741 | path=data_path, | |
|
3742 | startDate=startDate, | |
|
3743 | endDate=endDate, | |
|
3744 | startTime=startTime, | |
|
3745 | endTime=endTime, | |
|
3746 | online=online, | |
|
3747 | delay=delay, | |
|
3748 |
|
|
|
3749 |
|
|
|
3750 | ||
|
3751 | ||
|
4038 | path=data_path, | |
|
4039 | startDate=startDate, | |
|
4040 | endDate=endDate, | |
|
4041 | startTime=startTime, | |
|
4042 | endTime=endTime, | |
|
4043 | online=online, | |
|
4044 | delay=delay, | |
|
4045 | ippKm=set | |
|
4046 | ) | |
|
3752 | 4047 | |
|
3753 | 4048 | return readUnitConfObj |
|
3754 | 4049 | |
@@ -3770,7 +4065,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3770 | 4065 | def addPUWindow(self): |
|
3771 | 4066 | |
|
3772 | 4067 | self.configUPWindowObj = UnitProcessWindow(self) |
|
3773 |
fatherObj = self.getSelected |
|
|
4068 | fatherObj = self.getSelectedItemObj() | |
|
3774 | 4069 | try: |
|
3775 | 4070 | fatherObj.getElementName() |
|
3776 | 4071 | except: |
@@ -3810,7 +4105,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3810 | 4105 | |
|
3811 | 4106 | self.showtabPUCreated(datatype) |
|
3812 | 4107 | |
|
3813 |
self. |
|
|
4108 | self.clearPUWindow(datatype) | |
|
3814 | 4109 | |
|
3815 | 4110 | self.showPUinitView() |
|
3816 | 4111 | |
@@ -3968,8 +4263,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3968 | 4263 | self.bufferProject("Parameters", "Time zone", "Local") |
|
3969 | 4264 | self.bufferProject("Description", "Summary ", description) |
|
3970 | 4265 | |
|
3971 |
self.propertiesModel = |
|
|
3972 |
self.propertiesModel.showPro |
|
|
4266 | self.propertiesModel = TreeModel() | |
|
4267 | self.propertiesModel.showProperties(self.projectProperCaracteristica, self.projectProperPrincipal, self.projectProperDescripcion) | |
|
3973 | 4268 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
3974 | 4269 | self.treeProjectProperties.expandAll() |
|
3975 | 4270 | self.treeProjectProperties.resizeColumnToContents(0) |
@@ -3982,7 +4277,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3982 | 4277 | return datatype , dpath , startDate , endDate, startTime, endTime, online, delay, walk, set |
|
3983 | 4278 | |
|
3984 | 4279 | def showPUinitView(self): |
|
3985 |
self.propertiesModel = |
|
|
4280 | self.propertiesModel = TreeModel() | |
|
3986 | 4281 | self.propertiesModel.initPUVoltageView() |
|
3987 | 4282 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
3988 | 4283 | self.treeProjectProperties.expandAll() |
@@ -4213,8 +4508,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4213 | 4508 | |
|
4214 | 4509 | # set model PU Properties |
|
4215 | 4510 | |
|
4216 |
self.propertiesModel = |
|
|
4217 |
self.propertiesModel.showP |
|
|
4511 | self.propertiesModel = TreeModel() | |
|
4512 | self.propertiesModel.showProperties(self.volProperCaracteristica, self.volProperPrincipal, self.volProperDescripcion) | |
|
4218 | 4513 | self.volProperCaracteristica = [] |
|
4219 | 4514 | self.volProperPrincipal = [] |
|
4220 | 4515 | self.volProperDescripcion = [] |
@@ -4949,8 +5244,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4949 | 5244 | |
|
4950 | 5245 | # set model PU Properties |
|
4951 | 5246 | |
|
4952 |
self.propertiesModel = |
|
|
4953 |
self.propertiesModel.showP |
|
|
5247 | self.propertiesModel = TreeModel() | |
|
5248 | self.propertiesModel.showProperties(self.specProperCaracteristica, self.specProperPrincipal, self.specProperDescripcion) | |
|
4954 | 5249 | |
|
4955 | 5250 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
4956 | 5251 | self.treeProjectProperties.expandAll() |
@@ -5187,8 +5482,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5187 | 5482 | |
|
5188 | 5483 | # set model PU Properties |
|
5189 | 5484 | |
|
5190 |
self.propertiesModel = |
|
|
5191 |
self.propertiesModel.showP |
|
|
5485 | self.propertiesModel = TreeModel() | |
|
5486 | self.propertiesModel.showProperties(self.specHeisProperCaracteristica, self.specHeisProperPrincipal, self.specHeisProperDescripcion) | |
|
5192 | 5487 | |
|
5193 | 5488 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
5194 | 5489 | self.treeProjectProperties.expandAll() |
@@ -5307,13 +5602,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5307 | 5602 | |
|
5308 | 5603 | self.__itemTreeDict[id] = itemTree |
|
5309 | 5604 | |
|
5310 |
def addPU2PELoadXML(self, id, name, i |
|
|
5605 | def addPU2PELoadXML(self, id, name, inputId): | |
|
5311 | 5606 | |
|
5312 | 5607 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
5313 | if self.__itemTreeDict.has_key(idParent): | |
|
5314 | self.parentItem = self.__itemTreeDict[idParent] | |
|
5608 | ||
|
5609 | if self.__itemTreeDict.has_key(inputId): | |
|
5610 | self.parentItem = self.__itemTreeDict[inputId] | |
|
5315 | 5611 | else: |
|
5316 |
self.parentItem = self. |
|
|
5612 | self.parentItem = self.__itemTreeDict[inputId[0]] | |
|
5613 | ||
|
5317 | 5614 | self.parentItem.appendRow(itemTree) |
|
5318 | 5615 | self.projectExplorerTree.expandAll() |
|
5319 | 5616 | self.parentItem = itemTree |
@@ -5325,29 +5622,39 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5325 | 5622 | # print "stop" |
|
5326 | 5623 | |
|
5327 | 5624 | def getSelectedProjectObj(self): |
|
5625 | """ | |
|
5626 | Return the current project object selected. If a processing unit is | |
|
5627 | actually selected this function returns associated project. | |
|
5328 | 5628 | |
|
5629 | None if any project or processing unit is selected | |
|
5630 | """ | |
|
5329 | 5631 | for key in self.__itemTreeDict.keys(): |
|
5330 | 5632 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
5331 | 5633 | continue |
|
5332 | 5634 | |
|
5333 | 5635 | if self.__projectObjDict.has_key(key): |
|
5334 | 5636 | projectObj = self.__projectObjDict[key] |
|
5637 | return projectObj | |
|
5638 | ||
|
5639 | puObj = self.__puObjDict[key] | |
|
5640 | ||
|
5641 | if puObj.parentId == None: | |
|
5642 | projectId = puObj.getId()[0] | |
|
5335 | 5643 | else: |
|
5336 |
p |
|
|
5337 | if puObj.parentId == None: | |
|
5338 | id = puObj.getId()[0] | |
|
5339 | else: | |
|
5340 | id = puObj.parentId | |
|
5341 | projectObj = self.__projectObjDict[id] | |
|
5644 | projectId = puObj.parentId | |
|
5645 | ||
|
5646 | projectObj = self.__projectObjDict[projectId] | |
|
5342 | 5647 | |
|
5343 | 5648 | return projectObj |
|
5344 | 5649 | |
|
5345 | self.showWarning() | |
|
5346 | ||
|
5347 | 5650 | return None |
|
5348 | 5651 | |
|
5349 |
def getSelected |
|
|
5652 | def getSelectedItemObj(self): | |
|
5653 | """ | |
|
5654 | Return the current project or processing unit object selected | |
|
5350 | 5655 | |
|
5656 | None if any project or processing unit is selected | |
|
5657 | """ | |
|
5351 | 5658 | for key in self.__itemTreeDict.keys(): |
|
5352 | 5659 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
5353 | 5660 | continue |
@@ -5359,8 +5666,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5359 | 5666 | |
|
5360 | 5667 | return fatherObj |
|
5361 | 5668 | |
|
5362 | self.showWarning() | |
|
5363 | ||
|
5364 | 5669 | return None |
|
5365 | 5670 | |
|
5366 | 5671 | def openProject(self): |
@@ -5370,10 +5675,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5370 | 5675 | |
|
5371 | 5676 | self.create = False |
|
5372 | 5677 | self.frame_2.setEnabled(True) |
|
5373 | home = expanduser("~") | |
|
5374 | self.dir = os.path.join(home, 'schain_workspace') | |
|
5678 | ||
|
5375 | 5679 | # print self.dir |
|
5376 |
filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self. |
|
|
5680 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) | |
|
5377 | 5681 | self.console.clear() |
|
5378 | 5682 | projectObjLoad = Project() |
|
5379 | 5683 | try: |
@@ -5383,34 +5687,38 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5383 | 5687 | self.console.append("The selected xml file could not be loaded ...") |
|
5384 | 5688 | return 0 |
|
5385 | 5689 | |
|
5386 | project_name, description = projectObjLoad.name, projectObjLoad.description | |
|
5690 | self.refreshProjectWindow2(projectObjLoad) | |
|
5691 | self.refreshProjectProperties(projectObjLoad) | |
|
5692 | # project_name, description = projectObjLoad.name, projectObjLoad.description | |
|
5387 | 5693 | id = projectObjLoad.id |
|
5388 | 5694 | self.__projectObjDict[id] = projectObjLoad |
|
5389 | # Project Properties | |
|
5390 | datatype, data_path, startDate, endDate, startTime, endTime , online , delay, walk, set = self.showProjectProperties(projectObjLoad) | |
|
5391 | # show ProjectView | |
|
5392 |
self.addProject2ProjectExplorer(id=id, name=project |
|
|
5393 | self.refreshProjectWindow(project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, set) | |
|
5394 | ||
|
5395 | if datatype == "Voltage": | |
|
5396 | ext = '.r' | |
|
5397 | self.specOpProfiles.setEnabled(True) | |
|
5398 | self.specOpippFactor.setEnabled(True) | |
|
5399 | elif datatype == "Spectra": | |
|
5400 | ext = '.pdata' | |
|
5401 | self.specOpProfiles.setEnabled(False) | |
|
5402 | self.specOpippFactor.setEnabled(False) | |
|
5403 | elif datatype == "Fits": | |
|
5404 | ext = '.fits' | |
|
5405 | ||
|
5406 | if online == 0: | |
|
5407 | self.loadDays(data_path, ext, walk) | |
|
5408 | else: | |
|
5409 | self.proComStartDate.setEnabled(False) | |
|
5410 | self.proComEndDate.setEnabled(False) | |
|
5411 |
self.pro |
|
|
5412 |
self.pro |
|
|
5413 |
self. |
|
|
5695 | # # Project Properties | |
|
5696 | # datatype, data_path, startDate, endDate, startTime, endTime , online , delay, walk, set = self.showProjectProperties(projectObjLoad) | |
|
5697 | # # show ProjectView | |
|
5698 | self.addProject2ProjectExplorer(id=id, name=projectObjLoad.name) | |
|
5699 | # self.refreshProjectWindow(project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, set) | |
|
5700 | # | |
|
5701 | # if datatype == "Voltage": | |
|
5702 | # ext = '.r' | |
|
5703 | # self.specOpProfiles.setEnabled(True) | |
|
5704 | # self.specOpippFactor.setEnabled(True) | |
|
5705 | # elif datatype == "Spectra": | |
|
5706 | # ext = '.pdata' | |
|
5707 | # self.specOpProfiles.setEnabled(False) | |
|
5708 | # self.specOpippFactor.setEnabled(False) | |
|
5709 | # elif datatype == "Fits": | |
|
5710 | # ext = '.fits' | |
|
5711 | # elif datatype == "USRP": | |
|
5712 | # ext = '.hdf5' | |
|
5713 | # | |
|
5714 | # if online == 0: | |
|
5715 | # self.loadDays(data_path, ext, walk) | |
|
5716 | # else: | |
|
5717 | # self.proComStartDate.setEnabled(False) | |
|
5718 | # self.proComEndDate.setEnabled(False) | |
|
5719 | # self.proStartTime.setEnabled(False) | |
|
5720 | # self.proEndTime.setEnabled(False) | |
|
5721 | # self.frame_2.setEnabled(True) | |
|
5414 | 5722 | |
|
5415 | 5723 | self.tabWidgetProject.setEnabled(True) |
|
5416 | 5724 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
@@ -5418,26 +5726,28 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5418 | 5726 | self.tabProject.setEnabled(True) |
|
5419 | 5727 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) |
|
5420 | 5728 | |
|
5421 |
for |
|
|
5422 | # print puObj.datatype, puObj.inputId,puObj.getId(),puObj.parentId | |
|
5423 | self.__puObjDict[puObj.getId()] = puObj | |
|
5729 | for puId, puObj in puObjorderList.items(): | |
|
5730 | ||
|
5731 | # print "%s %s %s %s %s" %(puObj.datatype, inputId, puObj.inputId, puObj.getId(), puObj.parentId) | |
|
5732 | ||
|
5733 | self.__puObjDict[puId] = puObj | |
|
5424 | 5734 | |
|
5425 |
if puObj.inputId != |
|
|
5426 |
self.addPU2PELoadXML(id=pu |
|
|
5735 | if puObj.inputId != '0': | |
|
5736 | self.addPU2PELoadXML(id=puId , name=puObj.datatype , inputId=puObj.inputId) | |
|
5427 | 5737 | |
|
5428 | 5738 | if puObj.datatype == "Voltage": |
|
5429 | 5739 | self.refreshPUWindow(puObj.datatype, puObj) |
|
5430 |
self.sh |
|
|
5740 | self.refreshPUProperties(puObj) | |
|
5431 | 5741 | self.showtabPUCreated(datatype=puObj.datatype) |
|
5432 | 5742 | |
|
5433 | 5743 | if puObj.datatype == "Spectra": |
|
5434 | 5744 | self.refreshPUWindow(puObj.datatype, puObj) |
|
5435 |
self.sh |
|
|
5745 | self.refreshPUProperties(puObj) | |
|
5436 | 5746 | self.showtabPUCreated(datatype=puObj.datatype) |
|
5437 | 5747 | |
|
5438 | 5748 | if puObj.datatype == "SpectraHeis": |
|
5439 | 5749 | self.refreshPUWindow(puObj.datatype, puObj) |
|
5440 |
self. |
|
|
5750 | self.refreshPUProperties(puObj) | |
|
5441 | 5751 | self.showtabPUCreated(datatype=puObj.datatype) |
|
5442 | 5752 | |
|
5443 | 5753 | if puObj.name == "SendToServer": |
@@ -5447,7 +5757,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5447 | 5757 | opObj = puObj.getOperationObj(name="run") |
|
5448 | 5758 | self.saveFTPvalues(opObj) |
|
5449 | 5759 | |
|
5450 | self.console.clear() | |
|
5760 | # self.console.clear() | |
|
5451 | 5761 | self.console.append("The selected xml file has been loaded successfully") |
|
5452 | 5762 | # self.refreshPUWindow(datatype=datatype,puObj=puObj) |
|
5453 | 5763 | |
@@ -5460,13 +5770,17 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5460 | 5770 | if not self.__initialized: |
|
5461 | 5771 | return |
|
5462 | 5772 | |
|
5463 |
if not self.co |
|
|
5773 | if not self.controllerObj.isAlive(): | |
|
5464 | 5774 | self.stopProject() |
|
5465 | 5775 | |
|
5466 | 5776 | def playProject(self, ext=".xml"): |
|
5467 | 5777 | |
|
5468 | 5778 | projectObj = self.getSelectedProjectObj() |
|
5469 | 5779 | |
|
5780 | if not projectObj: | |
|
5781 | print "Please select a project before pressing PLAY" | |
|
5782 | return | |
|
5783 | ||
|
5470 | 5784 | filename = os.path.join(str(self.pathWorkSpace), |
|
5471 | 5785 | "%s%s%s" %(str(projectObj.name), str(projectObj.id), ext) |
|
5472 | 5786 | ) |
@@ -5487,7 +5801,10 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5487 | 5801 | self.actionStopToolbar.setEnabled(True) |
|
5488 | 5802 | |
|
5489 | 5803 | self.console.append("Please Wait...") |
|
5490 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PROCESS, filename)) | |
|
5804 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PROCESS, filename)) | |
|
5805 | ||
|
5806 | self.controllerObj = ControllerThread(filename) | |
|
5807 | self.controllerObj.start() | |
|
5491 | 5808 | sleep(0.5) |
|
5492 | 5809 | self.__initialized = True |
|
5493 | 5810 | |
@@ -5495,7 +5812,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5495 | 5812 | |
|
5496 | 5813 | self.__initialized = False |
|
5497 | 5814 | |
|
5498 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) | |
|
5815 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) | |
|
5816 | self.controllerObj.stop() | |
|
5499 | 5817 | |
|
5500 | 5818 | self.actionStart.setEnabled(True) |
|
5501 | 5819 | self.actionPause.setEnabled(False) |
@@ -5509,8 +5827,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5509 | 5827 | |
|
5510 | 5828 | def pauseProject(self): |
|
5511 | 5829 | |
|
5512 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) | |
|
5513 | ||
|
5830 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) | |
|
5831 | self.controllerObj.pause() | |
|
5832 | ||
|
5514 | 5833 | self.actionStart.setEnabled(False) |
|
5515 | 5834 | self.actionPause.setEnabled(True) |
|
5516 | 5835 | self.actionStop.setEnabled(True) |
@@ -5525,7 +5844,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5525 | 5844 | self.actionStarToolbar.setEnabled(False) |
|
5526 | 5845 | |
|
5527 | 5846 | sts = True |
|
5528 |
puObj = self.getSelected |
|
|
5847 | puObj = self.getSelectedItemObj() | |
|
5529 | 5848 | |
|
5530 | 5849 | if puObj != None: |
|
5531 | 5850 | if puObj.name == 'VoltageProc': |
@@ -5562,11 +5881,16 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5562 | 5881 | |
|
5563 | 5882 | return filename |
|
5564 | 5883 | |
|
5565 |
def |
|
|
5884 | def removeItemTreeFromProject(self): | |
|
5566 | 5885 | """ |
|
5567 | 5886 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol |
|
5568 | 5887 | """ |
|
5569 | 5888 | for key in self.__itemTreeDict.keys(): |
|
5889 | ||
|
5890 | #Check again because an item can delete multiple items (childs) | |
|
5891 | if key not in self.__itemTreeDict.keys(): | |
|
5892 | continue | |
|
5893 | ||
|
5570 | 5894 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
5571 | 5895 | continue |
|
5572 | 5896 | |
@@ -5577,14 +5901,13 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5577 | 5901 | |
|
5578 | 5902 | else: |
|
5579 | 5903 | puObj = self.__puObjDict[key] |
|
5580 |
i |
|
|
5581 | id = puObj.getId()[0] | |
|
5582 |
|
|
|
5583 | id = puObj.parentId | |
|
5584 | projectObj = self.__projectObjDict[id] | |
|
5904 | idProjectParent = puObj.parentId | |
|
5905 | projectObj = self.__projectObjDict[idProjectParent] | |
|
5906 | ||
|
5585 | 5907 | del self.__puObjDict[key] |
|
5586 | 5908 | del self.__itemTreeDict[key] |
|
5587 | 5909 | del projectObj.procUnitConfObjDict[key] |
|
5910 | ||
|
5588 | 5911 | for key in projectObj.procUnitConfObjDict.keys(): |
|
5589 | 5912 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): |
|
5590 | 5913 | continue |
@@ -5593,10 +5916,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5593 | 5916 | del projectObj.procUnitConfObjDict[key] |
|
5594 | 5917 | # print projectObj.procUnitConfObjDict |
|
5595 | 5918 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict |
|
5596 | self.showWarning() | |
|
5597 | ||
|
5598 | def showWarning(self): | |
|
5599 | pass | |
|
5600 | 5919 | |
|
5601 | 5920 | def getParmsFromProjectWindow(self): |
|
5602 | 5921 | """ |
@@ -5664,6 +5983,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5664 | 5983 | |
|
5665 | 5984 | |
|
5666 | 5985 | def setInputsProject_View(self): |
|
5986 | ||
|
5667 | 5987 | self.tabWidgetProject.setEnabled(True) |
|
5668 | 5988 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
5669 | 5989 | self.tabProject.setEnabled(True) |
@@ -5678,6 +5998,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5678 | 5998 | self.proComDataType.addItem("Voltage") |
|
5679 | 5999 | self.proComDataType.addItem("Spectra") |
|
5680 | 6000 | self.proComDataType.addItem("Fits") |
|
6001 | self.proComDataType.addItem("USRP") | |
|
5681 | 6002 | |
|
5682 | 6003 | self.proComStartDate.clear() |
|
5683 | 6004 | self.proComEndDate.clear() |
@@ -5699,10 +6020,16 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5699 | 6020 | # self.console.append("Introduce Project Parameters")DC |
|
5700 | 6021 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") |
|
5701 | 6022 | |
|
5702 |
def |
|
|
6023 | def clearPUWindow(self, datatype): | |
|
6024 | ||
|
5703 | 6025 | projectObjView = self.getSelectedProjectObj() |
|
5704 | idReadUnit = projectObjView.getReadUnitId() | |
|
5705 | readUnitObj = projectObjView.getProcUnitObj(idReadUnit) | |
|
6026 | ||
|
6027 | if not projectObjView: | |
|
6028 | return | |
|
6029 | ||
|
6030 | puObj = self.getSelectedItemObj() | |
|
6031 | inputId = puObj.getInputId() | |
|
6032 | inputPUObj = projectObjView.getProcUnitObj(inputId) | |
|
5706 | 6033 | |
|
5707 | 6034 | if datatype == 'Voltage': |
|
5708 | 6035 | self.volOpComChannels.setEnabled(False) |
@@ -5732,7 +6059,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5732 | 6059 | |
|
5733 | 6060 | if datatype == 'Spectra': |
|
5734 | 6061 | |
|
5735 |
if |
|
|
6062 | if inputPUObj.datatype == 'Spectra': | |
|
5736 | 6063 | self.specOpnFFTpoints.setEnabled(False) |
|
5737 | 6064 | self.specOpProfiles.setEnabled(False) |
|
5738 | 6065 | self.specOpippFactor.setEnabled(False) |
@@ -5849,93 +6176,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5849 | 6176 | self.tabSpectraHeis.setEnabled(True) |
|
5850 | 6177 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) |
|
5851 | 6178 | |
|
5852 | ||
|
5853 | def searchData(self, data_path, ext, walk, expLabel=''): | |
|
5854 | dateList = [] | |
|
5855 | fileList = [] | |
|
5856 | ||
|
5857 | if not os.path.exists(data_path): | |
|
5858 | return None | |
|
5859 | ||
|
5860 | if walk == 0: | |
|
5861 | files = os.listdir(data_path) | |
|
5862 | for thisFile in files: | |
|
5863 | thisExt = os.path.splitext(thisFile)[-1] | |
|
5864 | if thisExt == ext: | |
|
5865 | fileList.append(thisFile) | |
|
5866 | ||
|
5867 | for thisFile in fileList: | |
|
5868 | try: | |
|
5869 | year = int(thisFile[1:5]) | |
|
5870 | doy = int(thisFile[5:8]) | |
|
5871 | ||
|
5872 | date = datetime.date(year, 1, 1) + datetime.timedelta(doy - 1) | |
|
5873 | dateformat = date.strftime("%Y/%m/%d") | |
|
5874 | ||
|
5875 | if dateformat not in dateList: | |
|
5876 | dateList.append(dateformat) | |
|
5877 | except: | |
|
5878 | continue | |
|
5879 | # REVISION---------------------------------1 | |
|
5880 | if walk == 1: | |
|
5881 | ||
|
5882 | dirList = os.listdir(data_path) | |
|
5883 | ||
|
5884 | dirList.sort() | |
|
5885 | ||
|
5886 | dateList = [] | |
|
5887 | ||
|
5888 | for thisDir in dirList: | |
|
5889 | ||
|
5890 | if not isRadarPath(thisDir): | |
|
5891 | self.console.clear() | |
|
5892 | self.console.append("Please, Choose the Correct Path") | |
|
5893 | self.proOk.setEnabled(False) | |
|
5894 | continue | |
|
5895 | ||
|
5896 | doypath = os.path.join(data_path, thisDir, expLabel) | |
|
5897 | if not os.path.exists(doypath): | |
|
5898 | self.console.clear() | |
|
5899 | self.console.append("Please, Choose the Correct Path") | |
|
5900 | return | |
|
5901 | files = os.listdir(doypath) | |
|
5902 | fileList = [] | |
|
5903 | ||
|
5904 | for thisFile in files: | |
|
5905 | thisExt = os.path.splitext(thisFile)[-1] | |
|
5906 | if thisExt != ext: | |
|
5907 | self.console.clear() | |
|
5908 | self.console.append("There is no datatype selected in the Path Directory") | |
|
5909 | self.proOk.setEnabled(False) | |
|
5910 | continue | |
|
5911 | ||
|
5912 | if not isRadarFile(thisFile): | |
|
5913 | self.proOk.setEnabled(False) | |
|
5914 | self.console.clear() | |
|
5915 | self.console.append("Please, Choose the Correct Path") | |
|
5916 | continue | |
|
5917 | ||
|
5918 | fileList.append(thisFile) | |
|
5919 | break | |
|
5920 | ||
|
5921 | if fileList == []: | |
|
5922 | continue | |
|
5923 | ||
|
5924 | year = int(thisDir[1:5]) | |
|
5925 | doy = int(thisDir[5:8]) | |
|
5926 | ||
|
5927 | date = datetime.date(year, 1, 1) + datetime.timedelta(doy - 1) | |
|
5928 | dateformat = date.strftime("%Y/%m/%d") | |
|
5929 | dateList.append(dateformat) | |
|
5930 | ||
|
5931 | if len(dateList) > 0: | |
|
5932 | self.proOk.setEnabled(True) | |
|
5933 | return dateList | |
|
5934 | ||
|
5935 | ||
|
5936 | # self.proOk.setEnabled(False) | |
|
5937 | return None | |
|
5938 | ||
|
5939 | 6179 | def checkInputsProject(self): |
|
5940 | 6180 | """ |
|
5941 | 6181 | Check Inputs Project: |
@@ -5957,15 +6197,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5957 | 6197 | project_name = None |
|
5958 | 6198 | |
|
5959 | 6199 | datatype = str(self.proComDataType.currentText()) |
|
5960 | if not(datatype in ['Voltage', 'Spectra', 'Fits']): | |
|
5961 |
outputstr = 'datatype = %s, this must be either Voltage, Spectra |
|
|
6200 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): | |
|
6201 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype | |
|
5962 | 6202 | self.console.append(outputstr) |
|
5963 | 6203 | parms_ok = False |
|
5964 | 6204 | datatype = None |
|
5965 | 6205 | |
|
5966 | 6206 | ext = str(self.proDataType.text()) |
|
5967 | if not(ext in ['.r', '.pdata', '.fits']): | |
|
5968 |
outputstr = "extension files must be .r , .pdata |
|
|
6207 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): | |
|
6208 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" | |
|
5969 | 6209 | self.console.append(outputstr) |
|
5970 | 6210 | parms_ok = False |
|
5971 | 6211 | ext = None |
@@ -5979,7 +6219,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5979 | 6219 | data_path = None |
|
5980 | 6220 | |
|
5981 | 6221 | if data_path != None: |
|
5982 |
if not os.path. |
|
|
6222 | if not os.path.isdir(data_path): | |
|
5983 | 6223 | outputstr = 'Datapath:%s does not exists' % data_path |
|
5984 | 6224 | self.console.append(outputstr) |
|
5985 | 6225 | parms_ok = False |
@@ -6111,26 +6351,170 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
6111 | 6351 | |
|
6112 | 6352 | if datatype == "SpectraHeis": |
|
6113 | 6353 | return parms_ok, output_path, blocksperfile, metada |
|
6354 | ||
|
6355 | def searchData(self, data_path, ext, walk, expLabel=''): | |
|
6356 | dateList = [] | |
|
6357 | fileList = [] | |
|
6358 | ||
|
6359 | if not os.path.exists(data_path): | |
|
6360 | return None | |
|
6361 | ||
|
6362 | if walk == 0: | |
|
6363 | files = os.listdir(data_path) | |
|
6364 | for thisFile in files: | |
|
6365 | thisExt = os.path.splitext(thisFile)[-1] | |
|
6366 | if thisExt == ext: | |
|
6367 | fileList.append(thisFile) | |
|
6368 | ||
|
6369 | for thisFile in fileList: | |
|
6370 | try: | |
|
6371 | year = int(thisFile[1:5]) | |
|
6372 | doy = int(thisFile[5:8]) | |
|
6373 | ||
|
6374 | date = datetime.date(year, 1, 1) + datetime.timedelta(doy - 1) | |
|
6375 | dateformat = date.strftime("%Y/%m/%d") | |
|
6376 | ||
|
6377 | if dateformat not in dateList: | |
|
6378 | dateList.append(dateformat) | |
|
6379 | except: | |
|
6380 | continue | |
|
6381 | # REVISION---------------------------------1 | |
|
6382 | if walk == 1: | |
|
6383 | ||
|
6384 | dirList = os.listdir(data_path) | |
|
6385 | ||
|
6386 | dirList.sort() | |
|
6387 | ||
|
6388 | dateList = [] | |
|
6389 | ||
|
6390 | for thisDir in dirList: | |
|
6391 | ||
|
6392 | if not isRadarPath(thisDir): | |
|
6393 | self.console.clear() | |
|
6394 | self.console.append("Please, Choose the Correct Path") | |
|
6395 | self.proOk.setEnabled(False) | |
|
6396 | continue | |
|
6397 | ||
|
6398 | doypath = os.path.join(data_path, thisDir, expLabel) | |
|
6399 | if not os.path.exists(doypath): | |
|
6400 | self.console.clear() | |
|
6401 | self.console.append("Please, Choose the Correct Path") | |
|
6402 | return | |
|
6403 | files = os.listdir(doypath) | |
|
6404 | fileList = [] | |
|
6405 | ||
|
6406 | for thisFile in files: | |
|
6407 | thisExt = os.path.splitext(thisFile)[-1] | |
|
6408 | if thisExt != ext: | |
|
6409 | self.console.clear() | |
|
6410 | self.console.append("There is no datatype selected in the Path Directory") | |
|
6411 | self.proOk.setEnabled(False) | |
|
6412 | continue | |
|
6413 | ||
|
6414 | if not isRadarFile(thisFile): | |
|
6415 | self.proOk.setEnabled(False) | |
|
6416 | self.console.clear() | |
|
6417 | self.console.append("Please, Choose the Correct Path") | |
|
6418 | continue | |
|
6419 | ||
|
6420 | fileList.append(thisFile) | |
|
6421 | break | |
|
6422 | ||
|
6423 | if fileList == []: | |
|
6424 | continue | |
|
6425 | ||
|
6426 | year = int(thisDir[1:5]) | |
|
6427 | doy = int(thisDir[5:8]) | |
|
6428 | ||
|
6429 | date = datetime.date(year, 1, 1) + datetime.timedelta(doy - 1) | |
|
6430 | dateformat = date.strftime("%Y/%m/%d") | |
|
6431 | dateList.append(dateformat) | |
|
6432 | ||
|
6433 | if len(dateList) > 0: | |
|
6434 | self.proOk.setEnabled(True) | |
|
6435 | return dateList | |
|
6436 | ||
|
6437 | ||
|
6438 | # self.proOk.setEnabled(False) | |
|
6439 | return None | |
|
6440 | ||
|
6441 | def findDatafiles(self, data_path, ext, walk, expLabel=''): | |
|
6442 | ||
|
6443 | dateList = [] | |
|
6444 | fileList = [] | |
|
6445 | ||
|
6446 | if ext == ".r": | |
|
6447 | from schainpy.model.io.jroIO_base import JRODataReader | |
|
6448 | ||
|
6449 | readerObj = JRODataReader() | |
|
6450 | dateList = readerObj.findDatafiles(path=data_path, | |
|
6451 | expLabel=expLabel, | |
|
6452 | ext=ext, | |
|
6453 | walk=walk) | |
|
6454 | ||
|
6455 | if ext == ".pdata": | |
|
6456 | from schainpy.model.io.jroIO_base import JRODataReader | |
|
6457 | ||
|
6458 | readerObj = JRODataReader() | |
|
6459 | dateList = readerObj.findDatafiles(path=data_path, | |
|
6460 | expLabel=expLabel, | |
|
6461 | ext=ext, | |
|
6462 | walk=walk) | |
|
6463 | ||
|
6464 | if ext == ".fits": | |
|
6465 | from schainpy.model.io.jroIO_base import JRODataReader | |
|
6466 | ||
|
6467 | readerObj = JRODataReader() | |
|
6468 | dateList = readerObj.findDatafiles(path=data_path, | |
|
6469 | expLabel=expLabel, | |
|
6470 | ext=ext, | |
|
6471 | walk=walk) | |
|
6472 | ||
|
6473 | if ext == ".hdf5": | |
|
6474 | from schainpy.model.io.jroIO_usrp import USRPReader | |
|
6475 | ||
|
6476 | readerObj = USRPReader() | |
|
6477 | dateList = readerObj.findDatafiles(path=data_path) | |
|
6478 | ||
|
6479 | return dateList | |
|
6114 | 6480 | |
|
6115 | def loadDays(self, data_path, ext, walk): | |
|
6481 | def loadDays(self, data_path, ext, walk, expLabel=''): | |
|
6116 | 6482 | """ |
|
6117 | 6483 | Method to loads day |
|
6118 | 6484 | """ |
|
6119 | dateList = self.searchData(data_path, ext, walk) | |
|
6120 |
|
|
|
6485 | self.proOk.setEnabled(False) | |
|
6486 | self.dateList = [] | |
|
6487 | ||
|
6488 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) | |
|
6489 | ||
|
6490 | if not dateList: | |
|
6121 | 6491 | self.console.clear() |
|
6122 | 6492 | outputstr = "The path: %s is empty with file extension *%s" % (data_path, ext) |
|
6123 | 6493 | self.console.append(outputstr) |
|
6124 | 6494 | return |
|
6125 | 6495 | |
|
6126 |
|
|
|
6496 | dateStrList = [] | |
|
6127 | 6497 | for thisDate in dateList: |
|
6128 | self.proComStartDate.addItem(thisDate) | |
|
6129 | self.proComEndDate.addItem(thisDate) | |
|
6498 | dateStr = thisDate.strftime("%Y/%m/%d") | |
|
6499 | ||
|
6500 | self.proComStartDate.addItem(dateStr) | |
|
6501 | self.proComEndDate.addItem(dateStr) | |
|
6502 | dateStrList.append(dateStr) | |
|
6503 | ||
|
6130 | 6504 | self.proComEndDate.setCurrentIndex(self.proComStartDate.count() - 1) |
|
6131 | 6505 | |
|
6132 | def setWorkSpaceGUI(self, pathWorkSpace): | |
|
6133 | self.pathWorkSpace = pathWorkSpace | |
|
6506 | self.dateList = dateStrList | |
|
6507 | self.proOk.setEnabled(True) | |
|
6508 | ||
|
6509 | return self.dateList | |
|
6510 | ||
|
6511 | def setWorkSpaceGUI(self, pathWorkSpace=None): | |
|
6512 | ||
|
6513 | if pathWorkSpace == None: | |
|
6514 | home = os.path.expanduser("~") | |
|
6515 | pathWorkSpace = os.path.join(home,'schain_workspace') | |
|
6516 | ||
|
6517 | self.pathWorkSpace = pathWorkSpace | |
|
6134 | 6518 | |
|
6135 | 6519 | """ |
|
6136 | 6520 | Comandos Usados en Console |
@@ -6173,7 +6557,11 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
6173 | 6557 | self.actionStop.setShortcut('Ctrl+3') |
|
6174 | 6558 | |
|
6175 | 6559 | self.actionFTP.setShortcut('Ctrl+F') |
|
6176 | ||
|
6560 | ||
|
6561 | self.actionStart.setEnabled(False) | |
|
6562 | self.actionPause.setEnabled(False) | |
|
6563 | self.actionStop.setEnabled(False) | |
|
6564 | ||
|
6177 | 6565 | self.actionStarToolbar.setEnabled(False) |
|
6178 | 6566 | self.actionPauseToolbar.setEnabled(False) |
|
6179 | 6567 | self.actionStopToolbar.setEnabled(False) |
@@ -6210,7 +6598,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
6210 | 6598 | self.projectExplorerTree.expandAll() |
|
6211 | 6599 | # set model Project Properties |
|
6212 | 6600 | |
|
6213 |
self.propertiesModel = |
|
|
6601 | self.propertiesModel = TreeModel() | |
|
6214 | 6602 | self.propertiesModel.initProjectView() |
|
6215 | 6603 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
6216 | 6604 | self.treeProjectProperties.expandAll() |
@@ -6325,7 +6713,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
6325 | 6713 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
6326 | 6714 | |
|
6327 | 6715 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
6328 | sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) | |
|
6716 | # sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) | |
|
6329 | 6717 | |
|
6330 | 6718 | |
|
6331 | 6719 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
@@ -9,8 +9,12 from schainpy.controller import Project | |||
|
9 | 9 | from command import * |
|
10 | 10 | |
|
11 | 11 | class ControllerThread(threading.Thread): |
|
12 | ||
|
12 | 13 | def __init__(self, filename, data_q=None): |
|
14 | ||
|
13 | 15 | super(ControllerThread, self).__init__() |
|
16 | self.setDaemon(True) | |
|
17 | ||
|
14 | 18 | self.filename = filename |
|
15 | 19 | self.data_q = data_q |
|
16 | 20 | self.control = {'stop':False,'pause':False} |
@@ -69,7 +73,6 class CommCtrlProcessThread(threading.Thread): | |||
|
69 | 73 | cmd = self.cmd_q.get(True, 0.1) |
|
70 | 74 | self.handlers[cmd.type](cmd) |
|
71 | 75 | except Queue.Empty as e: |
|
72 | sleep(0.1) | |
|
73 | 76 | continue |
|
74 | 77 | |
|
75 | 78 | def isRunning(self): |
@@ -92,6 +95,13 class CommCtrlProcessThread(threading.Thread): | |||
|
92 | 95 | |
|
93 | 96 | def _handle_ioSTOP(self, cmd): |
|
94 | 97 | self.controllerObj.stop() |
|
98 | ||
|
99 | while self.controllerObj.isAlive(): | |
|
100 | self.console.clear() | |
|
101 | self.console.append("Close graphics before continue...") | |
|
102 | sleep(0.1) | |
|
103 | ||
|
104 | ||
|
95 | 105 | self.controllerObj.join() |
|
96 | 106 | # print "Process thread finished" |
|
97 | 107 |
@@ -43,6 +43,7 class Ui_ProjectTab(object): | |||
|
43 | 43 | self.proComDataType.addItem(_fromUtf8("")) |
|
44 | 44 | self.proComDataType.addItem(_fromUtf8("")) |
|
45 | 45 | self.proComDataType.addItem(_fromUtf8("")) |
|
46 | self.proComDataType.addItem(_fromUtf8("")) | |
|
46 | 47 | self.gridLayout_2.addWidget(self.proComDataType, 1, 1, 1, 5) |
|
47 | 48 | self.proDataType = QtGui.QLineEdit(self.frame) |
|
48 | 49 | self.proDataType.setObjectName(_fromUtf8("proDataType")) |
@@ -148,6 +149,7 class Ui_ProjectTab(object): | |||
|
148 | 149 | self.proComDataType.setItemText(0, _translate("MainWindow", "Voltage", None)) |
|
149 | 150 | self.proComDataType.setItemText(1, _translate("MainWindow", "Spectra", None)) |
|
150 | 151 | self.proComDataType.setItemText(2, _translate("MainWindow", "Fits", None)) |
|
152 | self.proComDataType.setItemText(3, _translate("MainWindow", "USRP", None)) | |
|
151 | 153 | self.label_15.setText(_translate("MainWindow", "DataPath :", None)) |
|
152 | 154 | self.proToolPath.setText(_translate("MainWindow", "...", None)) |
|
153 | 155 | self.label_23.setText(_translate("MainWindow", "Read Mode:", None)) |
@@ -156,7 +156,7 class HDF5Reader(ProcessingUnit): | |||
|
156 | 156 | for thisPath in os.listdir(single_path): |
|
157 | 157 | if not os.path.isdir(os.path.join(single_path,thisPath)): |
|
158 | 158 | continue |
|
159 |
if not is |
|
|
159 | if not isRadarFolder(thisPath): | |
|
160 | 160 | continue |
|
161 | 161 | |
|
162 | 162 | dirList.append(thisPath) |
@@ -261,19 +261,36 def checkForRealPath(path, foldercounter, year, doy, set, ext): | |||
|
261 | 261 | |
|
262 | 262 | return fullfilename, filename |
|
263 | 263 | |
|
264 |
def is |
|
|
264 | def isRadarFolder(folder): | |
|
265 | 265 | try: |
|
266 | 266 | year = int(folder[1:5]) |
|
267 | except: | |
|
268 | return 0 | |
|
269 | ||
|
270 | try: | |
|
271 | 267 | doy = int(folder[5:8]) |
|
272 | 268 | except: |
|
273 | 269 | return 0 |
|
274 | 270 | |
|
275 | 271 | return 1 |
|
276 | 272 | |
|
273 | def isRadarFile(file): | |
|
274 | try: | |
|
275 | year = int(file[1:5]) | |
|
276 | doy = int(file[5:8]) | |
|
277 | set = int(file[8:11]) | |
|
278 | except: | |
|
279 | return 0 | |
|
280 | ||
|
281 | return 1 | |
|
282 | ||
|
283 | def getDateFromRadarFile(file): | |
|
284 | try: | |
|
285 | year = int(file[1:5]) | |
|
286 | doy = int(file[5:8]) | |
|
287 | set = int(file[8:11]) | |
|
288 | except: | |
|
289 | return None | |
|
290 | ||
|
291 | thisDate = datetime.date(year, 1, 1) + datetime.timedelta(doy-1) | |
|
292 | return thisDate | |
|
293 | ||
|
277 | 294 | class JRODataIO: |
|
278 | 295 | |
|
279 | 296 | c = 3E8 |
@@ -382,23 +399,23 class JRODataReader(JRODataIO): | |||
|
382 | 399 | |
|
383 | 400 | """ |
|
384 | 401 | |
|
385 |
raise |
|
|
402 | # raise NotImplementedError, "This method has not been implemented" | |
|
386 | 403 | |
|
387 | 404 | |
|
388 | 405 | def createObjByDefault(self): |
|
389 | 406 | """ |
|
390 | 407 | |
|
391 | 408 | """ |
|
392 |
raise |
|
|
409 | raise NotImplementedError, "This method has not been implemented" | |
|
393 | 410 | |
|
394 | 411 | def getBlockDimension(self): |
|
395 | 412 | |
|
396 |
raise |
|
|
413 | raise NotImplementedError, "No implemented" | |
|
397 | 414 | |
|
398 | 415 | def __searchFilesOffLine(self, |
|
399 | 416 | path, |
|
400 | startDate, | |
|
401 | endDate, | |
|
417 | startDate=None, | |
|
418 | endDate=None, | |
|
402 | 419 | startTime=datetime.time(0,0,0), |
|
403 | 420 | endTime=datetime.time(23,59,59), |
|
404 | 421 | set=None, |
@@ -406,6 +423,9 class JRODataReader(JRODataIO): | |||
|
406 | 423 | ext='.r', |
|
407 | 424 | walk=True): |
|
408 | 425 | |
|
426 | self.filenameList = [] | |
|
427 | self.datetimeList = [] | |
|
428 | ||
|
409 | 429 | pathList = [] |
|
410 | 430 | |
|
411 | 431 | if not walk: |
@@ -422,28 +442,32 class JRODataReader(JRODataIO): | |||
|
422 | 442 | for thisPath in os.listdir(single_path): |
|
423 | 443 | if not os.path.isdir(os.path.join(single_path,thisPath)): |
|
424 | 444 | continue |
|
425 |
if not is |
|
|
445 | if not isRadarFolder(thisPath): | |
|
426 | 446 | continue |
|
427 | 447 | |
|
428 | 448 | dirList.append(thisPath) |
|
429 | 449 | |
|
430 | 450 | if not(dirList): |
|
431 | 451 | return None, None |
|
432 | ||
|
433 |
|
|
|
434 | ||
|
435 | while(thisDate <= endDate): | |
|
436 |
|
|
|
437 |
|
|
|
438 | ||
|
439 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') | |
|
440 | if len(matchlist) == 0: | |
|
452 | ||
|
453 | if startDate and endDate: | |
|
454 | thisDate = startDate | |
|
455 | ||
|
456 | while(thisDate <= endDate): | |
|
457 | year = thisDate.timetuple().tm_year | |
|
458 | doy = thisDate.timetuple().tm_yday | |
|
459 | ||
|
460 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') | |
|
461 | if len(matchlist) == 0: | |
|
462 | thisDate += datetime.timedelta(1) | |
|
463 | continue | |
|
464 | for match in matchlist: | |
|
465 | pathList.append(os.path.join(single_path,match,expLabel)) | |
|
466 | ||
|
441 | 467 | thisDate += datetime.timedelta(1) |
|
442 |
|
|
|
443 |
for |
|
|
444 |
pathList.append(os.path.join(single_path, |
|
|
445 | ||
|
446 | thisDate += datetime.timedelta(1) | |
|
468 | else: | |
|
469 | for thiDir in dirList: | |
|
470 | pathList.append(os.path.join(single_path,thiDir,expLabel)) | |
|
447 | 471 | |
|
448 | 472 | if pathList == []: |
|
449 | 473 | print "Any folder was found for the date range: %s-%s" %(startDate, endDate) |
@@ -536,7 +560,7 class JRODataReader(JRODataIO): | |||
|
536 | 560 | for thisPath in os.listdir(path): |
|
537 | 561 | if not os.path.isdir(os.path.join(path,thisPath)): |
|
538 | 562 | continue |
|
539 |
if not is |
|
|
563 | if not isRadarFolder(thisPath): | |
|
540 | 564 | continue |
|
541 | 565 | |
|
542 | 566 | dirList.append(thisPath) |
@@ -928,6 +952,85 class JRODataReader(JRODataIO): | |||
|
928 | 952 | |
|
929 | 953 | return True |
|
930 | 954 | |
|
955 | def findDatafiles(self, path, startDate=None, endDate=None, expLabel='', ext='.r', walk=True): | |
|
956 | ||
|
957 | dateList = [] | |
|
958 | pathList = [] | |
|
959 | ||
|
960 | if not walk: | |
|
961 | #pathList.append(path) | |
|
962 | multi_path = path.split(',') | |
|
963 | for single_path in multi_path: | |
|
964 | ||
|
965 | ok = False | |
|
966 | fileList = glob.glob1(single_path, "*"+ext) | |
|
967 | ||
|
968 | for thisFile in fileList: | |
|
969 | ||
|
970 | if not os.path.isfile(os.path.join(single_path, thisFile)): | |
|
971 | continue | |
|
972 | ||
|
973 | if not isRadarFile(thisFile): | |
|
974 | continue | |
|
975 | ||
|
976 | ok = True | |
|
977 | thisDate = getDateFromRadarFile(thisFile) | |
|
978 | ||
|
979 | if thisDate not in dateList: | |
|
980 | dateList.append(thisDate) | |
|
981 | ||
|
982 | if ok: | |
|
983 | pathList.append(single_path) | |
|
984 | ||
|
985 | return dateList | |
|
986 | ||
|
987 | multi_path = path.split(',') | |
|
988 | for single_path in multi_path: | |
|
989 | ||
|
990 | dirList = [] | |
|
991 | ||
|
992 | for thisPath in os.listdir(single_path): | |
|
993 | ||
|
994 | if not os.path.isdir(os.path.join(single_path,thisPath)): | |
|
995 | continue | |
|
996 | ||
|
997 | if not isRadarFolder(thisPath): | |
|
998 | continue | |
|
999 | ||
|
1000 | dirList.append(thisPath) | |
|
1001 | ||
|
1002 | if not dirList: | |
|
1003 | return dateList | |
|
1004 | ||
|
1005 | if startDate and endDate: | |
|
1006 | thisDate = startDate | |
|
1007 | ||
|
1008 | while(thisDate <= endDate): | |
|
1009 | year = thisDate.timetuple().tm_year | |
|
1010 | doy = thisDate.timetuple().tm_yday | |
|
1011 | ||
|
1012 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') | |
|
1013 | if len(matchlist) == 0: | |
|
1014 | thisDate += datetime.timedelta(1) | |
|
1015 | continue | |
|
1016 | ||
|
1017 | for match in matchlist: | |
|
1018 | pathList.append(os.path.join(single_path,match,expLabel)) | |
|
1019 | dateList.append(thisDate) | |
|
1020 | ||
|
1021 | thisDate += datetime.timedelta(1) | |
|
1022 | else: | |
|
1023 | for thiDir in dirList: | |
|
1024 | year = int(folder[1:5]) | |
|
1025 | doy = int(folder[5:8]) | |
|
1026 | thisDate = datetime.date(year,1,1) + datetime.timedelta(doy-1) | |
|
1027 | ||
|
1028 | pathList.append(os.path.join(single_path,thiDir,expLabel)) | |
|
1029 | dateList.append(thisDate) | |
|
1030 | ||
|
1031 | return dateList | |
|
1032 | ||
|
1033 | ||
|
931 | 1034 | def setup(self, |
|
932 | 1035 | path=None, |
|
933 | 1036 | startDate=None, |
@@ -23,7 +23,7 except: | |||
|
23 | 23 | |
|
24 | 24 | from xml.etree.ElementTree import ElementTree |
|
25 | 25 | |
|
26 |
from jroIO_base import is |
|
|
26 | from jroIO_base import isRadarFolder, isNumber | |
|
27 | 27 | from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit |
|
28 | 28 | |
|
29 | 29 | class Fits: |
@@ -479,7 +479,7 class FitsReader(ProcessingUnit): | |||
|
479 | 479 | for thisPath in os.listdir(path): |
|
480 | 480 | if not os.path.isdir(os.path.join(path,thisPath)): |
|
481 | 481 | continue |
|
482 |
if not is |
|
|
482 | if not isRadarFolder(thisPath): | |
|
483 | 483 | continue |
|
484 | 484 | |
|
485 | 485 | dirList.append(thisPath) |
@@ -119,7 +119,57 class USRPReader(ProcessingUnit): | |||
|
119 | 119 | self.dataOut.frequency = self.__frequency |
|
120 | 120 | |
|
121 | 121 | self.dataOut.realtime = self.__online |
|
122 | ||
|
123 | def findDatafiles(self, path, startDate=None, endDate=None): | |
|
124 | ||
|
125 | try: | |
|
126 | digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) | |
|
127 | except: | |
|
128 | digitalReadObj = digital_rf_hdf5.read_hdf5(path) | |
|
129 | ||
|
130 | channelNameList = digitalReadObj.get_channels() | |
|
131 | ||
|
132 | metadata_dict = digitalReadObj.get_rf_file_metadata(channelNameList[0]) | |
|
133 | ||
|
134 | sample_rate = metadata_dict['sample_rate'][0] | |
|
135 | ||
|
136 | this_metadata_file = digitalReadObj.get_metadata(channelNameList[0]) | |
|
137 | ||
|
138 | try: | |
|
139 | timezone = this_metadata_file['timezone'].value | |
|
140 | except: | |
|
141 | timezone = 0 | |
|
142 | ||
|
143 | startUTCSecond, endUTCSecond = digitalReadObj.get_bounds(channelNameList[0])/sample_rate - timezone | |
|
144 | ||
|
145 | startDatetime = datetime.datetime.utcfromtimestamp(startUTCSecond) | |
|
146 | endDatatime = datetime.datetime.utcfromtimestamp(endUTCSecond) | |
|
147 | ||
|
148 | if not startDate: | |
|
149 | startDate = startDatetime.date() | |
|
150 | ||
|
151 | if not endDate: | |
|
152 | endDate = endDatatime.date() | |
|
153 | ||
|
154 | dateList = [] | |
|
155 | ||
|
156 | thisDatetime = startDatetime | |
|
157 | ||
|
158 | while(thisDatetime<=endDatatime): | |
|
159 | ||
|
160 | thisDate = thisDatetime.date() | |
|
161 | ||
|
162 | if thisDate < startDate: | |
|
163 | continue | |
|
164 | ||
|
165 | if thisDate > endDate: | |
|
166 | break | |
|
167 | ||
|
168 | dateList.append(thisDate) | |
|
169 | thisDatetime += datetime.timedelta(1) | |
|
122 | 170 | |
|
171 | return dateList | |
|
172 | ||
|
123 | 173 | def setup(self, path = None, |
|
124 | 174 | startDate = None, |
|
125 | 175 | endDate = None, |
@@ -127,10 +177,12 class USRPReader(ProcessingUnit): | |||
|
127 | 177 | endTime = datetime.time(23,59,59), |
|
128 | 178 | channelList = None, |
|
129 | 179 | nSamples = None, |
|
130 |
ippKm = |
|
|
180 | ippKm = 60, | |
|
131 | 181 | online = False, |
|
132 |
|
|
|
133 |
|
|
|
182 | delay = 60, | |
|
183 | buffer_size = None, | |
|
184 | nbuffer = 1024, | |
|
185 | **kwargs): | |
|
134 | 186 | ''' |
|
135 | 187 | In this method we should set all initial parameters. |
|
136 | 188 | |
@@ -144,8 +196,12 class USRPReader(ProcessingUnit): | |||
|
144 | 196 | expLabel |
|
145 | 197 | ext |
|
146 | 198 | online |
|
147 |
|
|
|
199 | delay | |
|
148 | 200 | ''' |
|
201 | ||
|
202 | if not buffer_size: | |
|
203 | buffer_size = nbuffer | |
|
204 | ||
|
149 | 205 | try: |
|
150 | 206 | self.digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) |
|
151 | 207 | except: |
@@ -241,6 +297,7 class USRPReader(ProcessingUnit): | |||
|
241 | 297 | |
|
242 | 298 | self.profileIndex = 0 |
|
243 | 299 | |
|
300 | self.__delay = delay | |
|
244 | 301 | self.__ippKm = ippKm |
|
245 | 302 | self.__codeType = codeType |
|
246 | 303 | self.__nCode = nCode |
@@ -253,7 +310,7 class USRPReader(ProcessingUnit): | |||
|
253 | 310 | self.__channelNameList = channelNameListFiltered |
|
254 | 311 | self.__channelBoundList = channelBoundList |
|
255 | 312 | self.__nSamples = nSamples |
|
256 |
self.__samples_to_read = |
|
|
313 | self.__samples_to_read = buffer_size*nSamples | |
|
257 | 314 | self.__nChannels = len(self.__channelList) |
|
258 | 315 | |
|
259 | 316 | self.__startUTCSecond = startUTCSecond |
@@ -292,7 +349,10 class USRPReader(ProcessingUnit): | |||
|
292 | 349 | # ) |
|
293 | 350 | print "[Reading] reloading metadata ..." |
|
294 | 351 | |
|
295 | self.digitalReadObj.reload(complete_update=True) | |
|
352 | try: | |
|
353 | self.digitalReadObj.reload(complete_update=True) | |
|
354 | except: | |
|
355 | self.digitalReadObj.reload() | |
|
296 | 356 | |
|
297 | 357 | start_index, end_index = self.digitalReadObj.get_bounds(self.__channelNameList[self.__channelList[0]]) |
|
298 | 358 | |
@@ -458,7 +518,7 class USRPReader(ProcessingUnit): | |||
|
458 | 518 | if not self.isConfig: |
|
459 | 519 | self.setup(**kwargs) |
|
460 | 520 | |
|
461 | self.getData() | |
|
521 | self.getData(seconds=self.__delay) | |
|
462 | 522 | |
|
463 | 523 | return |
|
464 | 524 |
General Comments 0
You need to be logged in to leave comments.
Login now