@@ -112,7 +112,7 class GenericData(object): | |||
|
112 | 112 | |
|
113 | 113 | def __init__(self): |
|
114 | 114 | |
|
115 | raise ValueError, "This class has not been implemented" | |
|
115 | raise NotImplementedError | |
|
116 | 116 | |
|
117 | 117 | def copy(self, inputObj=None): |
|
118 | 118 | |
@@ -216,11 +216,11 class JROData(GenericData): | |||
|
216 | 216 | |
|
217 | 217 | def __init__(self): |
|
218 | 218 | |
|
219 | raise ValueError, "This class has not been implemented" | |
|
219 | raise NotImplementedError | |
|
220 | 220 | |
|
221 | 221 | def getNoise(self): |
|
222 | 222 | |
|
223 |
raise |
|
|
223 | raise NotImplementedError | |
|
224 | 224 | |
|
225 | 225 | def getNChannels(self): |
|
226 | 226 | |
@@ -341,9 +341,6 class JROData(GenericData): | |||
|
341 | 341 | self.radarControllerHeaderObj.nBaud = nBaud |
|
342 | 342 | |
|
343 | 343 | return |
|
344 | # def getTimeInterval(self): | |
|
345 | # | |
|
346 | # raise IOError, "This method should be implemented inside each Class" | |
|
347 | 344 | |
|
348 | 345 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
349 | 346 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
@@ -69,18 +69,18 PROCESSING_STRUCTURE = numpy.dtype([ | |||
|
69 | 69 | class Header(object): |
|
70 | 70 | |
|
71 | 71 | def __init__(self): |
|
72 | raise | |
|
72 | raise NotImplementedError | |
|
73 | 73 | |
|
74 | 74 | def copy(self): |
|
75 | 75 | return copy.deepcopy(self) |
|
76 | 76 | |
|
77 | 77 | def read(self): |
|
78 | 78 | |
|
79 |
raise |
|
|
79 | raise NotImplementedError | |
|
80 | 80 | |
|
81 | 81 | def write(self): |
|
82 | 82 | |
|
83 |
raise |
|
|
83 | raise NotImplementedError | |
|
84 | 84 | |
|
85 | 85 | def printInfo(self): |
|
86 | 86 | |
@@ -122,24 +122,24 class BasicHeader(Header): | |||
|
122 | 122 | self.useLocalTime = useLocalTime |
|
123 | 123 | |
|
124 | 124 | def read(self, fp): |
|
125 | ||
|
125 | 126 | try: |
|
126 | ||
|
127 | 127 | header = numpy.fromfile(fp, BASIC_STRUCTURE,1) |
|
128 | 128 | |
|
129 | self.size = int(header['nSize'][0]) | |
|
130 | self.version = int(header['nVersion'][0]) | |
|
131 | self.dataBlock = int(header['nDataBlockId'][0]) | |
|
132 | self.utc = int(header['nUtime'][0]) | |
|
133 | self.miliSecond = int(header['nMilsec'][0]) | |
|
134 | self.timeZone = int(header['nTimezone'][0]) | |
|
135 | self.dstFlag = int(header['nDstflag'][0]) | |
|
136 | self.errorCount = int(header['nErrorCount'][0]) | |
|
137 | ||
|
138 | 129 | except Exception, e: |
|
139 | 130 | print "BasicHeader: " |
|
140 | 131 | print e |
|
141 | 132 | return 0 |
|
142 | 133 | |
|
134 | self.size = int(header['nSize'][0]) | |
|
135 | self.version = int(header['nVersion'][0]) | |
|
136 | self.dataBlock = int(header['nDataBlockId'][0]) | |
|
137 | self.utc = int(header['nUtime'][0]) | |
|
138 | self.miliSecond = int(header['nMilsec'][0]) | |
|
139 | self.timeZone = int(header['nTimezone'][0]) | |
|
140 | self.dstFlag = int(header['nDstflag'][0]) | |
|
141 | self.errorCount = int(header['nErrorCount'][0]) | |
|
142 | ||
|
143 | 143 | return 1 |
|
144 | 144 | |
|
145 | 145 | def write(self, fp): |
@@ -189,22 +189,22 class SystemHeader(Header): | |||
|
189 | 189 | |
|
190 | 190 | try: |
|
191 | 191 | header = numpy.fromfile(fp,SYSTEM_STRUCTURE,1) |
|
192 | ||
|
193 | self.size = header['nSize'][0] | |
|
194 | self.nSamples = header['nNumSamples'][0] | |
|
195 | self.nProfiles = header['nNumProfiles'][0] | |
|
196 | self.nChannels = header['nNumChannels'][0] | |
|
197 | self.adcResolution = header['nADCResolution'][0] | |
|
198 | self.pciDioBusWidth = header['nPCDIOBusWidth'][0] | |
|
199 | ||
|
200 | 192 | except Exception, e: |
|
201 | 193 | print "SystemHeader: " + e |
|
202 | 194 | return 0 |
|
203 | 195 | |
|
196 | self.size = header['nSize'][0] | |
|
197 | self.nSamples = header['nNumSamples'][0] | |
|
198 | self.nProfiles = header['nNumProfiles'][0] | |
|
199 | self.nChannels = header['nNumChannels'][0] | |
|
200 | self.adcResolution = header['nADCResolution'][0] | |
|
201 | self.pciDioBusWidth = header['nPCDIOBusWidth'][0] | |
|
202 | ||
|
204 | 203 | endFp = self.size + startFp |
|
205 | 204 | |
|
206 | 205 | if fp.tell() != endFp: |
|
207 |
|
|
|
206 | print "System Header is not consistent" | |
|
207 | return 0 | |
|
208 | 208 | |
|
209 | 209 | return 1 |
|
210 | 210 | |
@@ -286,7 +286,11 class RadarControllerHeader(Header): | |||
|
286 | 286 | |
|
287 | 287 | |
|
288 | 288 | startFp = fp.tell() |
|
289 | header = numpy.fromfile(fp,RADAR_STRUCTURE,1) | |
|
289 | try: | |
|
290 | header = numpy.fromfile(fp,RADAR_STRUCTURE,1) | |
|
291 | except Exception, e: | |
|
292 | print "RadarControllerHeader: " + e | |
|
293 | return 0 | |
|
290 | 294 | |
|
291 | 295 | size = int(header['nSize'][0]) |
|
292 | 296 | self.expType = int(header['nExpType'][0]) |
@@ -339,7 +343,8 class RadarControllerHeader(Header): | |||
|
339 | 343 | endFp = size + startFp |
|
340 | 344 | |
|
341 | 345 | if fp.tell() != endFp: |
|
342 |
|
|
|
346 | print "Radar Controller Header is not consistent" | |
|
347 | return 0 | |
|
343 | 348 | |
|
344 | 349 | return 1 |
|
345 | 350 | |
@@ -484,7 +489,11 class ProcessingHeader(Header): | |||
|
484 | 489 | |
|
485 | 490 | startFp = fp.tell() |
|
486 | 491 | |
|
487 | header = numpy.fromfile(fp,PROCESSING_STRUCTURE,1) | |
|
492 | try: | |
|
493 | header = numpy.fromfile(fp,PROCESSING_STRUCTURE,1) | |
|
494 | except Exception, e: | |
|
495 | print "ProcessingHeader: " + e | |
|
496 | return 0 | |
|
488 | 497 | |
|
489 | 498 | size = int(header['nSize'][0]) |
|
490 | 499 | self.dtype = int(header['nDataType'][0]) |
@@ -553,7 +562,8 class ProcessingHeader(Header): | |||
|
553 | 562 | endFp = size + startFp |
|
554 | 563 | |
|
555 | 564 | if fp.tell() != endFp: |
|
556 |
|
|
|
565 | print "Processing Header is not consistent" | |
|
566 | return 0 | |
|
557 | 567 | |
|
558 | 568 | return 1 |
|
559 | 569 |
@@ -258,8 +258,8 class HDF5Reader(ProcessingUnit): | |||
|
258 | 258 | try: |
|
259 | 259 | fp = fp = h5py.File(filename,'r') |
|
260 | 260 | except IOError: |
|
261 | traceback.print_exc() | |
|
262 | raise IOError, "The file %s can't be opened" %(filename) | |
|
261 | print "File %s can't be opened" %(filename) | |
|
262 | return None | |
|
263 | 263 | |
|
264 | 264 | grp = fp['Data'] |
|
265 | 265 | timeAux = grp['time'] |
@@ -68,8 +68,8 def isFileInEpoch(filename, startUTSeconds, endUTSeconds): | |||
|
68 | 68 | try: |
|
69 | 69 | fp = open(filename,'rb') |
|
70 | 70 | except IOError: |
|
71 | traceback.print_exc() | |
|
72 | raise IOError, "The file %s can't be opened" %(filename) | |
|
71 | print "The file %s can't be opened" %(filename) | |
|
72 | return 0 | |
|
73 | 73 | |
|
74 | 74 | sts = basicHeaderObj.read(fp) |
|
75 | 75 | fp.close() |
@@ -112,8 +112,8 def isFileInTimeRange(filename, startDate, endDate, startTime, endTime): | |||
|
112 | 112 | try: |
|
113 | 113 | fp = open(filename,'rb') |
|
114 | 114 | except IOError: |
|
115 | traceback.print_exc() | |
|
116 | raise IOError, "The file %s can't be opened" %(filename) | |
|
115 | print "The file %s can't be opened" %(filename) | |
|
116 | return None | |
|
117 | 117 | |
|
118 | 118 | basicHeaderObj = BasicHeader(LOCALTIME) |
|
119 | 119 | sts = basicHeaderObj.read(fp) |
@@ -182,7 +182,8 def isFolderInDateRange(folder, startDate=None, endDate=None): | |||
|
182 | 182 | basename = os.path.basename(folder) |
|
183 | 183 | |
|
184 | 184 | if not isRadarFolder(basename): |
|
185 |
|
|
|
185 | print "The folder %s has not the rigth format" %folder | |
|
186 | return 0 | |
|
186 | 187 | |
|
187 | 188 | if startDate and endDate: |
|
188 | 189 | thisDate = getDateFromRadarFolder(basename) |
@@ -223,7 +224,8 def isFileInDateRange(filename, startDate=None, endDate=None): | |||
|
223 | 224 | basename = os.path.basename(filename) |
|
224 | 225 | |
|
225 | 226 | if not isRadarFile(basename): |
|
226 |
|
|
|
227 | print "The filename %s has not the rigth format" %filename | |
|
228 | return 0 | |
|
227 | 229 | |
|
228 | 230 | if startDate and endDate: |
|
229 | 231 | thisDate = getDateFromRadarFile(basename) |
@@ -477,11 +479,11 class JRODataIO: | |||
|
477 | 479 | |
|
478 | 480 | def __init__(self): |
|
479 | 481 | |
|
480 |
raise |
|
|
482 | raise NotImplementedError | |
|
481 | 483 | |
|
482 | 484 | def run(self): |
|
483 | 485 | |
|
484 |
raise |
|
|
486 | raise NotImplementedError | |
|
485 | 487 | |
|
486 | 488 | def getDtypeWidth(self): |
|
487 | 489 | |
@@ -526,21 +528,25 class JRODataReader(JRODataIO): | |||
|
526 | 528 | def __init__(self): |
|
527 | 529 | |
|
528 | 530 | """ |
|
529 | ||
|
530 | """ | |
|
531 | This class is used to find data files | |
|
531 | 532 |
|
|
532 | # raise NotImplementedError, "This method has not been implemented" | |
|
533 | Example: | |
|
534 | reader = JRODataReader() | |
|
535 | fileList = reader.findDataFiles() | |
|
536 | ||
|
537 | """ | |
|
538 | pass | |
|
533 | 539 | |
|
534 | 540 | |
|
535 | 541 | def createObjByDefault(self): |
|
536 | 542 | """ |
|
537 | 543 | |
|
538 | 544 | """ |
|
539 |
raise NotImplementedError |
|
|
545 | raise NotImplementedError | |
|
540 | 546 | |
|
541 | 547 | def getBlockDimension(self): |
|
542 | 548 | |
|
543 |
raise NotImplementedError |
|
|
549 | raise NotImplementedError | |
|
544 | 550 | |
|
545 | 551 | def __searchFilesOffLine(self, |
|
546 | 552 | path, |
@@ -561,9 +567,9 class JRODataReader(JRODataIO): | |||
|
561 | 567 | dateList, pathList = self.findDatafiles(path, startDate, endDate, expLabel, ext, walk, include_path=True) |
|
562 | 568 | |
|
563 | 569 | if dateList == []: |
|
564 | print "[Reading] No *%s files in %s from %s to %s)"%(ext, path, | |
|
565 | datetime.datetime.combine(startDate,startTime).ctime(), | |
|
566 | datetime.datetime.combine(endDate,endTime).ctime()) | |
|
570 | # print "[Reading] No *%s files in %s from %s to %s)"%(ext, path, | |
|
571 | # datetime.datetime.combine(startDate,startTime).ctime(), | |
|
572 | # datetime.datetime.combine(endDate,endTime).ctime()) | |
|
567 | 573 | |
|
568 | 574 | return None, None |
|
569 | 575 | |
@@ -1006,16 +1012,19 class JRODataReader(JRODataIO): | |||
|
1006 | 1012 | self.getBlockDimension() |
|
1007 | 1013 | |
|
1008 | 1014 | def __verifyFile(self, filename, msgFlag=True): |
|
1015 | ||
|
1009 | 1016 | msg = None |
|
1017 | ||
|
1010 | 1018 | try: |
|
1011 | 1019 | fp = open(filename, 'rb') |
|
1012 | currentPosition = fp.tell() | |
|
1013 | 1020 | except IOError: |
|
1014 | traceback.print_exc() | |
|
1021 | ||
|
1015 | 1022 | if msgFlag: |
|
1016 |
print "[Reading] |
|
|
1023 | print "[Reading] File %s can't be opened" % (filename) | |
|
1024 | ||
|
1017 | 1025 | return False |
|
1018 | ||
|
1026 | ||
|
1027 | currentPosition = fp.tell() | |
|
1019 | 1028 | neededSize = self.processingHeaderObj.blockSize + self.firstHeaderSize |
|
1020 | 1029 | |
|
1021 | 1030 | if neededSize == 0: |
@@ -1023,34 +1032,35 class JRODataReader(JRODataIO): | |||
|
1023 | 1032 | systemHeaderObj = SystemHeader() |
|
1024 | 1033 | radarControllerHeaderObj = RadarControllerHeader() |
|
1025 | 1034 | processingHeaderObj = ProcessingHeader() |
|
1026 | ||
|
1027 | try: | |
|
1028 | if not( basicHeaderObj.read(fp) ): raise IOError | |
|
1029 | if not( systemHeaderObj.read(fp) ): raise IOError | |
|
1030 | if not( radarControllerHeaderObj.read(fp) ): raise IOError | |
|
1031 |
|
|
|
1032 | # data_type = int(numpy.log2((processingHeaderObj.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) | |
|
1033 | ||
|
1034 | neededSize = processingHeaderObj.blockSize + basicHeaderObj.size | |
|
1035 | ||
|
1036 | except IOError: | |
|
1037 | traceback.print_exc() | |
|
1038 | # sys.exit(0) | |
|
1039 | ||
|
1040 | if msgFlag: | |
|
1041 | print "[Reading] The file %s is empty or it hasn't enough data" % filename | |
|
1042 | ||
|
1035 | ||
|
1036 | if not( basicHeaderObj.read(fp) ): | |
|
1037 | fp.close() | |
|
1038 | return False | |
|
1039 | ||
|
1040 | if not( systemHeaderObj.read(fp) ): | |
|
1043 | 1041 | fp.close() |
|
1044 | 1042 | return False |
|
1043 | ||
|
1044 | if not( radarControllerHeaderObj.read(fp) ): | |
|
1045 | fp.close() | |
|
1046 | return False | |
|
1047 | ||
|
1048 | if not( processingHeaderObj.read(fp) ): | |
|
1049 | fp.close() | |
|
1050 | return False | |
|
1051 | ||
|
1052 | neededSize = processingHeaderObj.blockSize + basicHeaderObj.size | |
|
1045 | 1053 | else: |
|
1046 | 1054 | msg = "[Reading] Skipping the file %s due to it hasn't enough data" %filename |
|
1047 | 1055 | |
|
1048 | 1056 | fp.close() |
|
1057 | ||
|
1049 | 1058 | fileSize = os.path.getsize(filename) |
|
1050 | 1059 | currentSize = fileSize - currentPosition |
|
1060 | ||
|
1051 | 1061 | if currentSize < neededSize: |
|
1052 | 1062 | if msgFlag and (msg != None): |
|
1053 | print msg #print"\tSkipping the file %s due to it hasn't enough data" %filename | |
|
1063 | print msg | |
|
1054 | 1064 | return False |
|
1055 | 1065 | |
|
1056 | 1066 | return True |
@@ -1129,6 +1139,14 class JRODataReader(JRODataIO): | |||
|
1129 | 1139 | |
|
1130 | 1140 | dateList.sort() |
|
1131 | 1141 | |
|
1142 | if walk: | |
|
1143 | pattern_path = os.path.join(multi_path[0], "[dYYYYDDD]", expLabel) | |
|
1144 | else: | |
|
1145 | pattern_path = multi_path[0] | |
|
1146 | ||
|
1147 | if not dateList: | |
|
1148 | print "[Reading] No *%s files in %s from %s to %s" %(ext, pattern_path, startDate, endDate) | |
|
1149 | ||
|
1132 | 1150 | if include_path: |
|
1133 | 1151 | return dateList, pathList |
|
1134 | 1152 | |
@@ -1187,9 +1205,9 class JRODataReader(JRODataIO): | |||
|
1187 | 1205 | walk=walk) |
|
1188 | 1206 | |
|
1189 | 1207 | if not(pathList): |
|
1190 | print "[Reading] No *%s files in %s (%s - %s)"%(ext, path, | |
|
1191 | datetime.datetime.combine(startDate,startTime).ctime(), | |
|
1192 | datetime.datetime.combine(endDate,endTime).ctime()) | |
|
1208 | # print "[Reading] No *%s files in %s (%s - %s)"%(ext, path, | |
|
1209 | # datetime.datetime.combine(startDate,startTime).ctime(), | |
|
1210 | # datetime.datetime.combine(endDate,endTime).ctime()) | |
|
1193 | 1211 | |
|
1194 | 1212 | # sys.exit(-1) |
|
1195 | 1213 | |
@@ -1253,19 +1271,19 class JRODataReader(JRODataIO): | |||
|
1253 | 1271 | |
|
1254 | 1272 | def getFirstHeader(self): |
|
1255 | 1273 | |
|
1256 | raise ValueError, "This method has not been implemented" | |
|
1274 | raise NotImplementedError | |
|
1257 | 1275 | |
|
1258 | 1276 | def getData(self): |
|
1259 | 1277 | |
|
1260 | raise ValueError, "This method has not been implemented" | |
|
1278 | raise NotImplementedError | |
|
1261 | 1279 | |
|
1262 | 1280 | def hasNotDataInBuffer(self): |
|
1263 | 1281 | |
|
1264 | raise ValueError, "This method has not been implemented" | |
|
1282 | raise NotImplementedError | |
|
1265 | 1283 | |
|
1266 | 1284 | def readBlock(self): |
|
1267 | 1285 | |
|
1268 | raise ValueError, "This method has not been implemented" | |
|
1286 | raise NotImplementedError | |
|
1269 | 1287 | |
|
1270 | 1288 | def isEndProcess(self): |
|
1271 | 1289 | |
@@ -1331,23 +1349,23 class JRODataWriter(JRODataIO): | |||
|
1331 | 1349 | fileDate = None |
|
1332 | 1350 | |
|
1333 | 1351 | def __init__(self, dataOut=None): |
|
1334 |
raise |
|
|
1352 | raise NotImplementedError | |
|
1335 | 1353 | |
|
1336 | 1354 | |
|
1337 | 1355 | def hasAllDataInBuffer(self): |
|
1338 |
raise |
|
|
1356 | raise NotImplementedError | |
|
1339 | 1357 | |
|
1340 | 1358 | |
|
1341 | 1359 | def setBlockDimension(self): |
|
1342 |
raise |
|
|
1360 | raise NotImplementedError | |
|
1343 | 1361 | |
|
1344 | 1362 | |
|
1345 | 1363 | def writeBlock(self): |
|
1346 |
raise |
|
|
1364 | raise NotImplementedError | |
|
1347 | 1365 | |
|
1348 | 1366 | |
|
1349 | 1367 | def putData(self): |
|
1350 |
raise |
|
|
1368 | raise NotImplementedError | |
|
1351 | 1369 | |
|
1352 | 1370 | |
|
1353 | 1371 | def getProcessFlags(self): |
@@ -1413,7 +1431,7 class JRODataWriter(JRODataIO): | |||
|
1413 | 1431 | None |
|
1414 | 1432 | """ |
|
1415 | 1433 | |
|
1416 |
raise |
|
|
1434 | raise NotImplementedError | |
|
1417 | 1435 | |
|
1418 | 1436 | def __writeFirstHeader(self): |
|
1419 | 1437 | """ |
@@ -326,7 +326,8 class FitsReader(ProcessingUnit): | |||
|
326 | 326 | try: |
|
327 | 327 | fitsObj = pyfits.open(filename,'readonly') |
|
328 | 328 | except: |
|
329 |
|
|
|
329 | print "File %s can't be opened" %(filename) | |
|
330 | return None | |
|
330 | 331 | |
|
331 | 332 | header = fitsObj[0].header |
|
332 | 333 | struct_time = time.strptime(header['DATETIME'], "%b %d %Y %H:%M:%S") |
@@ -344,7 +345,7 class FitsReader(ProcessingUnit): | |||
|
344 | 345 | return thisDatetime |
|
345 | 346 | |
|
346 | 347 | def __setNextFileOnline(self): |
|
347 |
raise |
|
|
348 | raise NotImplementedError | |
|
348 | 349 | |
|
349 | 350 | def __setNextFileOffline(self): |
|
350 | 351 | idFile = self.fileIndex |
@@ -605,7 +606,7 class FitsReader(ProcessingUnit): | |||
|
605 | 606 | return 1 |
|
606 | 607 | |
|
607 | 608 | def __jumpToLastBlock(self): |
|
608 |
raise |
|
|
609 | raise NotImplementedError | |
|
609 | 610 | |
|
610 | 611 | def __waitNewBlock(self): |
|
611 | 612 | """ |
@@ -211,7 +211,7 class USRPReader(ProcessingUnit): | |||
|
211 | 211 | buffer_size = nbuffer |
|
212 | 212 | |
|
213 | 213 | if not os.path.isdir(path): |
|
214 |
raise ValueError, "[Reading] |
|
|
214 | raise ValueError, "[Reading] Directory %s does not exist" %path | |
|
215 | 215 | |
|
216 | 216 | try: |
|
217 | 217 | self.digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) |
@@ -221,7 +221,7 class USRPReader(ProcessingUnit): | |||
|
221 | 221 | channelNameList = self.digitalReadObj.get_channels() |
|
222 | 222 | |
|
223 | 223 | if not channelNameList: |
|
224 |
raise |
|
|
224 | raise ValueError, "[Reading] Directory %s does not have any files" %path | |
|
225 | 225 | |
|
226 | 226 | if not channelList: |
|
227 | 227 | channelList = range(len(channelNameList)) |
@@ -249,9 +249,9 class USRPReader(ProcessingUnit): | |||
|
249 | 249 | except: |
|
250 | 250 | codeType = 0 |
|
251 | 251 | |
|
252 |
nCode = |
|
|
253 |
nBaud = |
|
|
254 |
code = |
|
|
252 | nCode = 1 | |
|
253 | nBaud = 1 | |
|
254 | code = [1] | |
|
255 | 255 | |
|
256 | 256 | if codeType: |
|
257 | 257 | nCode = this_metadata_file['nCode'].value |
@@ -109,7 +109,7 class USRPReaderAPI(USRPReader, threading.Thread): | |||
|
109 | 109 | ''' |
|
110 | 110 | |
|
111 | 111 | if not self.isConfig: |
|
112 |
raise |
|
|
112 | raise RuntimeError, 'setup() method has to be called before start()' | |
|
113 | 113 | |
|
114 | 114 | while True: |
|
115 | 115 |
@@ -75,7 +75,7 class ProcessingUnit(object): | |||
|
75 | 75 | **kwargs : Diccionario de argumentos de la funcion a ejecutar |
|
76 | 76 | """ |
|
77 | 77 | |
|
78 |
raise |
|
|
78 | raise NotImplementedError | |
|
79 | 79 | |
|
80 | 80 | def callMethod(self, name, **kwargs): |
|
81 | 81 | |
@@ -187,17 +187,17 class ProcessingUnit(object): | |||
|
187 | 187 | if opType == 'self': |
|
188 | 188 | |
|
189 | 189 | if not opName: |
|
190 |
raise |
|
|
190 | raise ValueError, "opName parameter should be defined" | |
|
191 | 191 | |
|
192 | 192 | sts = self.callMethod(opName, **kwargs) |
|
193 | 193 | |
|
194 | 194 | if opType == 'other' or opType == 'external': |
|
195 | 195 | |
|
196 | 196 | if not opId: |
|
197 |
raise |
|
|
197 | raise ValueError, "opId parameter should be defined" | |
|
198 | 198 | |
|
199 | 199 | if opId not in self.operations2RunDict.keys(): |
|
200 |
raise |
|
|
200 | raise ValueError, "Id operation has not been registered" | |
|
201 | 201 | |
|
202 | 202 | sts = self.callObject(opId, **kwargs) |
|
203 | 203 | |
@@ -223,11 +223,11 class ProcessingUnit(object): | |||
|
223 | 223 | |
|
224 | 224 | def setup(self): |
|
225 | 225 | |
|
226 |
raise |
|
|
226 | raise NotImplementedError | |
|
227 | 227 | |
|
228 | 228 | def run(self): |
|
229 | 229 | |
|
230 |
raise |
|
|
230 | raise NotImplementedError | |
|
231 | 231 | |
|
232 | 232 | def close(self): |
|
233 | 233 | #Close every thread, queue or any other object here is it is neccesary. |
@@ -256,7 +256,7 class Operation(object): | |||
|
256 | 256 | |
|
257 | 257 | self.isConfig = True |
|
258 | 258 | |
|
259 |
raise |
|
|
259 | raise NotImplementedError | |
|
260 | 260 | |
|
261 | 261 | def run(self, dataIn, **kwargs): |
|
262 | 262 | |
@@ -279,7 +279,7 class Operation(object): | |||
|
279 | 279 | if not self.isConfig: |
|
280 | 280 | self.setup(**kwargs) |
|
281 | 281 | |
|
282 |
raise |
|
|
282 | raise NotImplementedError | |
|
283 | 283 | |
|
284 | 284 | def close(self): |
|
285 | 285 |
@@ -119,7 +119,6 class SpectraProc(ProcessingUnit): | |||
|
119 | 119 | |
|
120 | 120 | if nProfiles == None: |
|
121 | 121 | nProfiles = nFFTPoints |
|
122 | # raise ValueError, "This SpectraProc.run() need nProfiles input variable" | |
|
123 | 122 | |
|
124 | 123 | if ippFactor == None: |
|
125 | 124 | ippFactor = 1 |
@@ -272,7 +271,6 class SpectraProc(ProcessingUnit): | |||
|
272 | 271 | |
|
273 | 272 | if (maxHei > self.dataOut.heightList[-1]): |
|
274 | 273 | maxHei = self.dataOut.heightList[-1] |
|
275 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
276 | 274 | |
|
277 | 275 | minIndex = 0 |
|
278 | 276 | maxIndex = 0 |
@@ -359,9 +357,6 class SpectraProc(ProcessingUnit): | |||
|
359 | 357 | |
|
360 | 358 | if (maxIndex >= self.dataOut.nHeights): |
|
361 | 359 | maxIndex = self.dataOut.nHeights-1 |
|
362 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
|
363 | ||
|
364 | # nHeights = maxIndex - minIndex + 1 | |
|
365 | 360 | |
|
366 | 361 | #Spectra |
|
367 | 362 | data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1] |
@@ -99,7 +99,6 class VoltageProc(ProcessingUnit): | |||
|
99 | 99 | print channelIndexList |
|
100 | 100 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex |
|
101 | 101 | |
|
102 | # nChannels = len(channelIndexList) | |
|
103 | 102 | if self.dataOut.flagDataAsBlock: |
|
104 | 103 | """ |
|
105 | 104 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] |
@@ -138,15 +137,10 class VoltageProc(ProcessingUnit): | |||
|
138 | 137 | |
|
139 | 138 | if (minHei < self.dataOut.heightList[0]): |
|
140 | 139 | minHei = self.dataOut.heightList[0] |
|
141 | # raise ValueError, "height range [%d,%d] is not valid. Data height range is [%d, %d]" % (minHei, | |
|
142 | # maxHei, | |
|
143 | # self.dataOut.heightList[0], | |
|
144 | # self.dataOut.heightList[-1]) | |
|
145 | ||
|
140 | ||
|
146 | 141 | if (maxHei > self.dataOut.heightList[-1]): |
|
147 | 142 | maxHei = self.dataOut.heightList[-1] |
|
148 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
149 | ||
|
143 | ||
|
150 | 144 | minIndex = 0 |
|
151 | 145 | maxIndex = 0 |
|
152 | 146 | heights = self.dataOut.heightList |
@@ -187,14 +181,11 class VoltageProc(ProcessingUnit): | |||
|
187 | 181 | """ |
|
188 | 182 | |
|
189 | 183 | if (minIndex < 0) or (minIndex > maxIndex): |
|
190 |
raise ValueError, " |
|
|
184 | raise ValueError, "Height index range (%d,%d) is not valid" % (minIndex, maxIndex) | |
|
191 | 185 | |
|
192 | 186 | if (maxIndex >= self.dataOut.nHeights): |
|
193 | 187 | maxIndex = self.dataOut.nHeights |
|
194 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
|
195 | ||
|
196 | # nHeights = maxIndex - minIndex + 1 | |
|
197 | ||
|
188 | ||
|
198 | 189 | #voltage |
|
199 | 190 | if self.dataOut.flagDataAsBlock: |
|
200 | 191 | """ |
@@ -563,8 +554,7 class Decoder(Operation): | |||
|
563 | 554 | self.__nHeis = dataOut.nHeights |
|
564 | 555 | |
|
565 | 556 | if self.__nHeis < self.nBaud: |
|
566 |
|
|
|
567 | raise IOError, 'Number of heights (%d) should be greater than number of bauds (%d)' %(self.__nHeis, self.nBaud) | |
|
557 | raise ValueError, 'Number of heights (%d) should be greater than number of bauds (%d)' %(self.__nHeis, self.nBaud) | |
|
568 | 558 | |
|
569 | 559 | #Frequency |
|
570 | 560 | __codeBuffer = numpy.zeros((self.nCode, self.__nHeis), dtype=numpy.complex) |
@@ -602,14 +592,6 class Decoder(Operation): | |||
|
602 | 592 | |
|
603 | 593 | raise NotImplementedError |
|
604 | 594 | |
|
605 | # fft_code = self.fft_code[self.__profIndex].reshape(1,-1) | |
|
606 | # | |
|
607 | # data = cfunctions.decoder(fft_code, data) | |
|
608 | # | |
|
609 | # datadec = data#[:,:] | |
|
610 | # | |
|
611 | # return datadec | |
|
612 | ||
|
613 | 595 | def __convolutionInTime(self, data): |
|
614 | 596 | |
|
615 | 597 | code = self.code[self.__profIndex] |
@@ -654,8 +636,7 class Decoder(Operation): | |||
|
654 | 636 | |
|
655 | 637 | if code is None: |
|
656 | 638 | if dataOut.code is None: |
|
657 | print "Code is not defined" | |
|
658 | raise ValueError, "Code could not be read from %s object. Enter a value in Code parameter" %dataOut.type | |
|
639 | raise ValueError, "Code could not be read from %s instance. Enter a value in Code parameter" %dataOut.type | |
|
659 | 640 | |
|
660 | 641 | code = dataOut.code |
|
661 | 642 | else: |
@@ -750,7 +731,6 class ProfileConcat(Operation): | |||
|
750 | 731 | self.isConfig = True |
|
751 | 732 | |
|
752 | 733 | if dataOut.flagDataAsBlock: |
|
753 | ||
|
754 | 734 | raise ValueError, "ProfileConcat can only be used when voltage have been read profile by profile, getBlock = False" |
|
755 | 735 | |
|
756 | 736 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now