@@ -701,10 +701,10 class JRODataReader(JRODataIO, ProcessingUnit): | |||||
701 | processingHeaderObj = ProcessingHeader() |
|
701 | processingHeaderObj = ProcessingHeader() | |
702 |
|
702 | |||
703 | try: |
|
703 | try: | |
704 |
if not( basicHeaderObj.read(fp) ): raise |
|
704 | if not( basicHeaderObj.read(fp) ): raise IOError | |
705 |
if not( systemHeaderObj.read(fp) ): raise |
|
705 | if not( systemHeaderObj.read(fp) ): raise IOError | |
706 |
if not( radarControllerHeaderObj.read(fp) ): raise |
|
706 | if not( radarControllerHeaderObj.read(fp) ): raise IOError | |
707 |
if not( processingHeaderObj.read(fp) ): raise |
|
707 | if not( processingHeaderObj.read(fp) ): raise IOError | |
708 | data_type = int(numpy.log2((processingHeaderObj.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) |
|
708 | data_type = int(numpy.log2((processingHeaderObj.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) | |
709 |
|
709 | |||
710 | neededSize = processingHeaderObj.blockSize + basicHeaderObj.size |
|
710 | neededSize = processingHeaderObj.blockSize + basicHeaderObj.size |
@@ -3,7 +3,7 | |||||
3 | $Author: murco $ |
|
3 | $Author: murco $ | |
4 | $Id: JROHeaderIO.py 151 2012-10-31 19:00:51Z murco $ |
|
4 | $Id: JROHeaderIO.py 151 2012-10-31 19:00:51Z murco $ | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | import sys | ||
7 | import numpy |
|
7 | import numpy | |
8 | import copy |
|
8 | import copy | |
9 |
|
9 | |||
@@ -66,7 +66,9 class BasicHeader(Header): | |||||
66 | self.timeZone = int(header['nTimezone'][0]) |
|
66 | self.timeZone = int(header['nTimezone'][0]) | |
67 | self.dstFlag = int(header['nDstflag'][0]) |
|
67 | self.dstFlag = int(header['nDstflag'][0]) | |
68 | self.errorCount = int(header['nErrorCount'][0]) |
|
68 | self.errorCount = int(header['nErrorCount'][0]) | |
69 | except: |
|
69 | ||
|
70 | except Exception, e: | |||
|
71 | print "BasicHeader: " + e | |||
70 | return 0 |
|
72 | return 0 | |
71 |
|
73 | |||
72 | return 1 |
|
74 | return 1 | |
@@ -114,7 +116,9 class SystemHeader(Header): | |||||
114 | self.nChannels = header['nNumChannels'][0] |
|
116 | self.nChannels = header['nNumChannels'][0] | |
115 | self.adcResolution = header['nADCResolution'][0] |
|
117 | self.adcResolution = header['nADCResolution'][0] | |
116 | self.pciDioBusWidth = header['nPCDIOBusWidth'][0] |
|
118 | self.pciDioBusWidth = header['nPCDIOBusWidth'][0] | |
117 | except: |
|
119 | ||
|
120 | except Exception, e: | |||
|
121 | print "SystemHeader: " + e | |||
118 | return 0 |
|
122 | return 0 | |
119 |
|
123 | |||
120 | return 1 |
|
124 | return 1 | |
@@ -244,7 +248,7 class RadarControllerHeader(Header): | |||||
244 | self.code = numpy.empty([self.nCode,self.nBaud],dtype='u1') |
|
248 | self.code = numpy.empty([self.nCode,self.nBaud],dtype='u1') | |
245 | tempList = [] |
|
249 | tempList = [] | |
246 | for ic in range(self.nCode): |
|
250 | for ic in range(self.nCode): | |
247 | temp = numpy.fromfile(fp,'u1',4*numpy.ceil(self.nBaud/32.)) |
|
251 | temp = numpy.fromfile(fp,'u1',4*int(numpy.ceil(self.nBaud/32.))) | |
248 | tempList.append(temp) |
|
252 | tempList.append(temp) | |
249 | self.code[ic] = numpy.unpackbits(temp[::-1])[-1*self.nBaud:] |
|
253 | self.code[ic] = numpy.unpackbits(temp[::-1])[-1*self.nBaud:] | |
250 | self.code = 2.0*self.code - 1.0 |
|
254 | self.code = 2.0*self.code - 1.0 | |
@@ -259,8 +263,9 class RadarControllerHeader(Header): | |||||
259 | jumpFp = endFp - fp.tell() |
|
263 | jumpFp = endFp - fp.tell() | |
260 | if jumpFp > 0: |
|
264 | if jumpFp > 0: | |
261 | fp.seek(jumpFp) |
|
265 | fp.seek(jumpFp) | |
262 |
|
266 | |||
263 | except: |
|
267 | except Exception, e: | |
|
268 | print "RadarControllerHeader: " + e | |||
264 | return 0 |
|
269 | return 0 | |
265 |
|
270 | |||
266 | return 1 |
|
271 | return 1 | |
@@ -395,7 +400,8 class ProcessingHeader(Header): | |||||
395 | if nPairs > 0: |
|
400 | if nPairs > 0: | |
396 | self.flag_cspc = True |
|
401 | self.flag_cspc = True | |
397 |
|
402 | |||
398 | except: |
|
403 | except Exception, e: | |
|
404 | print "ProcessingHeader: " + e | |||
399 | return 0 |
|
405 | return 0 | |
400 |
|
406 | |||
401 | return 1 |
|
407 | return 1 |
General Comments 0
You need to be logged in to leave comments.
Login now