##// END OF EJS Templates
Se agrego manejo de excepciones para la lectura del header de los archivos en formato Jicamarca....
Miguel Valdez -
r52:1dd31bd293df
parent child
Show More
@@ -1,71 +1,71
1 '''
1 '''
2 Created on Feb 7, 2012
2 Created on Feb 7, 2012
3
3
4 @author $Author$
4 @author $Author$
5 @version $Id$
5 @version $Id$
6 '''
6 '''
7 import copy
7 import copy
8 from JROHeader import RadarControllerHeader, ProcessingHeader, SystemHeader, BasicHeader
8 from JROHeader import RadarControllerHeader, ProcessingHeader, SystemHeader, BasicHeader
9
9
10 class Data:
10 class Data:
11 '''
11 '''
12 classdocs
12 classdocs
13 '''
13 '''
14 __type = None
14 type = None
15
15
16 def __init__(self):
16 def __init__(self):
17 '''
17 '''
18 Constructor
18 Constructor
19 '''
19 '''
20 raise ValueError, "This class has not been implemented"
20 raise ValueError, "This class has not been implemented"
21
21
22 def copy(self, objIn=None):
22 def copy(self, objIn=None):
23
23
24 if objIn == None:
24 if objIn == None:
25 return copy.deepcopy(self)
25 return copy.deepcopy(self)
26
26
27 for key in objIn.__dict__.keys():
27 for key in objIn.__dict__.keys():
28 self.__dict__[key] = objIn.__dict__[key]
28 self.__dict__[key] = objIn.__dict__[key]
29
29
30 def deepcopy(self):
30 def deepcopy(self):
31
31
32 return copy.deepcopy(self)
32 return copy.deepcopy(self)
33
33
34 class Noise(Data):
34 class Noise(Data):
35 '''
35 '''
36 classdocs
36 classdocs
37 '''
37 '''
38
38
39 def __init__(self):
39 def __init__(self):
40 '''
40 '''
41 Constructor
41 Constructor
42 '''
42 '''
43 pass
43 pass
44
44
45 class JROData(Data):
45 class JROData(Data):
46 '''
46 '''
47 classdocs
47 classdocs
48 '''
48 '''
49 m_RadarControllerHeader = RadarControllerHeader()
49 m_RadarControllerHeader = RadarControllerHeader()
50 m_ProcessingHeader = ProcessingHeader()
50 m_ProcessingHeader = ProcessingHeader()
51 m_SystemHeader = SystemHeader()
51 m_SystemHeader = SystemHeader()
52 m_BasicHeader = BasicHeader()
52 m_BasicHeader = BasicHeader()
53 m_Noise = Noise()
53 m_NoiseObj = Noise()
54
54
55 data = None
55 data = None
56 dataType = None
56 dataType = None
57
57
58 nProfiles = None
58 nProfiles = None
59 nHeights = None
59 nHeights = None
60 nChannels = None
60 nChannels = None
61
61
62 heights = None
62 heights = None
63
63
64 flagNoData = False
64 flagNoData = False
65 flagResetProcessing = False
65 flagResetProcessing = False
66
66
67 def __init__(self):
67 def __init__(self):
68 '''
68 '''
69 Constructor
69 Constructor
70 '''
70 '''
71 raise ValueError, "This class has not been implemented" No newline at end of file
71 raise ValueError, "This class has not been implemented"
@@ -1,396 +1,405
1 '''
1 '''
2 Created on 23/01/2012
2 Created on 23/01/2012
3
3
4 @author $Author: vsarmiento $
4 @author $Author: vsarmiento $
5 @version $Id: HeaderIO.py 37 2012-03-26 22:55:13Z vsarmiento $
5 @version $Id: HeaderIO.py 37 2012-03-26 22:55:13Z vsarmiento $
6 '''
6 '''
7
7
8 import numpy
8 import numpy
9 import copy
9 import copy
10
10
11 class Header:
11 class Header:
12
12
13 def __init__(self):
13 def __init__(self):
14 raise
14 raise
15
15
16 def copy(self):
16 def copy(self):
17 return copy.deepcopy(self)
17 return copy.deepcopy(self)
18
18
19 def read():
19 def read():
20 pass
20 pass
21
21
22 def write():
22 def write():
23 pass
23 pass
24
24
25 class BasicHeader(Header):
25 class BasicHeader(Header):
26
26
27 size = None
27 size = None
28 version = None
28 version = None
29 dataBlock = None
29 dataBlock = None
30 utc = None
30 utc = None
31 miliSecond = None
31 miliSecond = None
32 timeZone = None
32 timeZone = None
33 dstFlag = None
33 dstFlag = None
34 errorCount = None
34 errorCount = None
35 struct = None
35 struct = None
36
36
37 def __init__(self):
37 def __init__(self):
38 self.size = 0
38 self.size = 0
39 self.version = 0
39 self.version = 0
40 self.dataBlock = 0
40 self.dataBlock = 0
41 self.utc = 0
41 self.utc = 0
42 self.miliSecond = 0
42 self.miliSecond = 0
43 self.timeZone = 0
43 self.timeZone = 0
44 self.dstFlag = 0
44 self.dstFlag = 0
45 self.errorCount = 0
45 self.errorCount = 0
46 self.struct = numpy.dtype([
46 self.struct = numpy.dtype([
47 ('nSize','<u4'),
47 ('nSize','<u4'),
48 ('nVersion','<u2'),
48 ('nVersion','<u2'),
49 ('nDataBlockId','<u4'),
49 ('nDataBlockId','<u4'),
50 ('nUtime','<u4'),
50 ('nUtime','<u4'),
51 ('nMilsec','<u2'),
51 ('nMilsec','<u2'),
52 ('nTimezone','<i2'),
52 ('nTimezone','<i2'),
53 ('nDstflag','<i2'),
53 ('nDstflag','<i2'),
54 ('nErrorCount','<u4')
54 ('nErrorCount','<u4')
55 ])
55 ])
56 pass
56 pass
57
57
58 def read(self, fp):
58 def read(self, fp):
59
59 try:
60 header = numpy.fromfile(fp, self.struct,1)
60 header = numpy.fromfile(fp, self.struct,1)
61 self.size = header['nSize'][0]
61 self.size = header['nSize'][0]
62 self.version = header['nVersion'][0]
62 self.version = header['nVersion'][0]
63 self.dataBlock = header['nDataBlockId'][0]
63 self.dataBlock = header['nDataBlockId'][0]
64 self.utc = header['nUtime'][0]
64 self.utc = header['nUtime'][0]
65 self.miliSecond = header['nMilsec'][0]
65 self.miliSecond = header['nMilsec'][0]
66 self.timeZone = header['nTimezone'][0]
66 self.timeZone = header['nTimezone'][0]
67 self.dstFlag = header['nDstflag'][0]
67 self.dstFlag = header['nDstflag'][0]
68 self.errorCount = header['nErrorCount'][0]
68 self.errorCount = header['nErrorCount'][0]
69 except:
70 return 0
69
71
70 return 1
72 return 1
71
73
72 def write(self, fp):
74 def write(self, fp):
73 headerTuple = (self.size,self.version,self.dataBlock,self.utc,self.miliSecond,self.timeZone,self.dstFlag,self.errorCount)
75 headerTuple = (self.size,self.version,self.dataBlock,self.utc,self.miliSecond,self.timeZone,self.dstFlag,self.errorCount)
74 header = numpy.array(headerTuple,self.struct)
76 header = numpy.array(headerTuple,self.struct)
75 header.tofile(fp)
77 header.tofile(fp)
76
78
77 return 1
79 return 1
78
80
79 class SystemHeader(Header):
81 class SystemHeader(Header):
80
82
81 size = None
83 size = None
82 numSamples = None
84 numSamples = None
83 numProfiles = None
85 numProfiles = None
84 numChannels = None
86 numChannels = None
85 adcResolution = None
87 adcResolution = None
86 pciDioBusWidth = None
88 pciDioBusWidth = None
87 struct = None
89 struct = None
88
90
89 def __init__(self):
91 def __init__(self):
90 self.size = 0
92 self.size = 0
91 self.numSamples = 0
93 self.numSamples = 0
92 self.numProfiles = 0
94 self.numProfiles = 0
93 self.numChannels = 0
95 self.numChannels = 0
94 self.adcResolution = 0
96 self.adcResolution = 0
95 self.pciDioBusWidth = 0
97 self.pciDioBusWidth = 0
96 self.struct = numpy.dtype([
98 self.struct = numpy.dtype([
97 ('nSize','<u4'),
99 ('nSize','<u4'),
98 ('nNumSamples','<u4'),
100 ('nNumSamples','<u4'),
99 ('nNumProfiles','<u4'),
101 ('nNumProfiles','<u4'),
100 ('nNumChannels','<u4'),
102 ('nNumChannels','<u4'),
101 ('nADCResolution','<u4'),
103 ('nADCResolution','<u4'),
102 ('nPCDIOBusWidth','<u4'),
104 ('nPCDIOBusWidth','<u4'),
103 ])
105 ])
104
106
105
107
106 def read(self, fp):
108 def read(self, fp):
107 header = numpy.fromfile(fp,self.struct,1)
109 try:
108 self.size = header['nSize'][0]
110 header = numpy.fromfile(fp,self.struct,1)
109 self.numSamples = header['nNumSamples'][0]
111 self.size = header['nSize'][0]
110 self.numProfiles = header['nNumProfiles'][0]
112 self.numSamples = header['nNumSamples'][0]
111 self.numChannels = header['nNumChannels'][0]
113 self.numProfiles = header['nNumProfiles'][0]
112 self.adcResolution = header['nADCResolution'][0]
114 self.numChannels = header['nNumChannels'][0]
113 self.pciDioBusWidth = header['nPCDIOBusWidth'][0]
115 self.adcResolution = header['nADCResolution'][0]
114
116 self.pciDioBusWidth = header['nPCDIOBusWidth'][0]
117 except:
118 return 0
115
119
116 return 1
120 return 1
117
121
118 def write(self, fp):
122 def write(self, fp):
119 headerTuple = (self.size,self.numSamples,self.numProfiles,self.numChannels,self.adcResolution,self.pciDioBusWidth)
123 headerTuple = (self.size,self.numSamples,self.numProfiles,self.numChannels,self.adcResolution,self.pciDioBusWidth)
120 header = numpy.array(headerTuple,self.struct)
124 header = numpy.array(headerTuple,self.struct)
121 header.tofile(fp)
125 header.tofile(fp)
122
126
123 return 1
127 return 1
124
128
125 class RadarControllerHeader(Header):
129 class RadarControllerHeader(Header):
126
130
127 size = None
131 size = None
128 expType = None
132 expType = None
129 nTx = None
133 nTx = None
130 ipp = None
134 ipp = None
131 txA = None
135 txA = None
132 txB = None
136 txB = None
133 numWindows = None
137 numWindows = None
134 numTaus = None
138 numTaus = None
135 codeType = None
139 codeType = None
136 line6Function = None
140 line6Function = None
137 line5Function = None
141 line5Function = None
138 fClock = None
142 fClock = None
139 prePulseBefore = None
143 prePulseBefore = None
140 prePulserAfter = None
144 prePulserAfter = None
141 rangeIpp = None
145 rangeIpp = None
142 rangeTxA = None
146 rangeTxA = None
143 rangeTxB = None
147 rangeTxB = None
144 struct = None
148 struct = None
145
149
146 def __init__(self):
150 def __init__(self):
147 self.size = 0
151 self.size = 0
148 self.expType = 0
152 self.expType = 0
149 self.nTx = 0
153 self.nTx = 0
150 self.ipp = 0
154 self.ipp = 0
151 self.txA = 0
155 self.txA = 0
152 self.txB = 0
156 self.txB = 0
153 self.numWindows = 0
157 self.numWindows = 0
154 self.numTaus = 0
158 self.numTaus = 0
155 self.codeType = 0
159 self.codeType = 0
156 self.line6Function = 0
160 self.line6Function = 0
157 self.line5Function = 0
161 self.line5Function = 0
158 self.fClock = 0
162 self.fClock = 0
159 self.prePulseBefore = 0
163 self.prePulseBefore = 0
160 self.prePulserAfter = 0
164 self.prePulserAfter = 0
161 self.rangeIpp = 0
165 self.rangeIpp = 0
162 self.rangeTxA = 0
166 self.rangeTxA = 0
163 self.rangeTxB = 0
167 self.rangeTxB = 0
164 self.struct = numpy.dtype([
168 self.struct = numpy.dtype([
165 ('nSize','<u4'),
169 ('nSize','<u4'),
166 ('nExpType','<u4'),
170 ('nExpType','<u4'),
167 ('nNTx','<u4'),
171 ('nNTx','<u4'),
168 ('fIpp','<f4'),
172 ('fIpp','<f4'),
169 ('fTxA','<f4'),
173 ('fTxA','<f4'),
170 ('fTxB','<f4'),
174 ('fTxB','<f4'),
171 ('nNumWindows','<u4'),
175 ('nNumWindows','<u4'),
172 ('nNumTaus','<u4'),
176 ('nNumTaus','<u4'),
173 ('nCodeType','<u4'),
177 ('nCodeType','<u4'),
174 ('nLine6Function','<u4'),
178 ('nLine6Function','<u4'),
175 ('nLine5Function','<u4'),
179 ('nLine5Function','<u4'),
176 ('fClock','<f4'),
180 ('fClock','<f4'),
177 ('nPrePulseBefore','<u4'),
181 ('nPrePulseBefore','<u4'),
178 ('nPrePulseAfter','<u4'),
182 ('nPrePulseAfter','<u4'),
179 ('sRangeIPP','<a20'),
183 ('sRangeIPP','<a20'),
180 ('sRangeTxA','<a20'),
184 ('sRangeTxA','<a20'),
181 ('sRangeTxB','<a20'),
185 ('sRangeTxB','<a20'),
182 ])
186 ])
183 self.dynamic = numpy.array([],numpy.dtype('byte'))
187 self.dynamic = numpy.array([],numpy.dtype('byte'))
184
188
185
189
186 def read(self, fp):
190 def read(self, fp):
187 header = numpy.fromfile(fp,self.struct,1)
191 try:
188 self.size = header['nSize'][0]
192 header = numpy.fromfile(fp,self.struct,1)
189 self.expType = header['nExpType'][0]
193 self.size = header['nSize'][0]
190 self.nTx = header['nNTx'][0]
194 self.expType = header['nExpType'][0]
191 self.ipp = header['fIpp'][0]
195 self.nTx = header['nNTx'][0]
192 self.txA = header['fTxA'][0]
196 self.ipp = header['fIpp'][0]
193 self.txB = header['fTxB'][0]
197 self.txA = header['fTxA'][0]
194 self.numWindows = header['nNumWindows'][0]
198 self.txB = header['fTxB'][0]
195 self.numTaus = header['nNumTaus'][0]
199 self.numWindows = header['nNumWindows'][0]
196 self.codeType = header['nCodeType'][0]
200 self.numTaus = header['nNumTaus'][0]
197 self.line6Function = header['nLine6Function'][0]
201 self.codeType = header['nCodeType'][0]
198 self.line5Function = header['nLine5Function'][0]
202 self.line6Function = header['nLine6Function'][0]
199 self.fClock = header['fClock'][0]
203 self.line5Function = header['nLine5Function'][0]
200 self.prePulseBefore = header['nPrePulseBefore'][0]
204 self.fClock = header['fClock'][0]
201 self.prePulserAfter = header['nPrePulseAfter'][0]
205 self.prePulseBefore = header['nPrePulseBefore'][0]
202 self.rangeIpp = header['sRangeIPP'][0]
206 self.prePulserAfter = header['nPrePulseAfter'][0]
203 self.rangeTxA = header['sRangeTxA'][0]
207 self.rangeIpp = header['sRangeIPP'][0]
204 self.rangeTxB = header['sRangeTxB'][0]
208 self.rangeTxA = header['sRangeTxA'][0]
205 # jump Dynamic Radar Controller Header
209 self.rangeTxB = header['sRangeTxB'][0]
206 jumpHeader = self.size - 116
210 # jump Dynamic Radar Controller Header
207 self.dynamic = numpy.fromfile(fp,numpy.dtype('byte'),jumpHeader)
211 jumpHeader = self.size - 116
212 self.dynamic = numpy.fromfile(fp,numpy.dtype('byte'),jumpHeader)
213 except:
214 return 0
208
215
209 return 1
216 return 1
210
217
211 def write(self, fp):
218 def write(self, fp):
212 headerTuple = (self.size,
219 headerTuple = (self.size,
213 self.expType,
220 self.expType,
214 self.nTx,
221 self.nTx,
215 self.ipp,
222 self.ipp,
216 self.txA,
223 self.txA,
217 self.txB,
224 self.txB,
218 self.numWindows,
225 self.numWindows,
219 self.numTaus,
226 self.numTaus,
220 self.codeType,
227 self.codeType,
221 self.line6Function,
228 self.line6Function,
222 self.line5Function,
229 self.line5Function,
223 self.fClock,
230 self.fClock,
224 self.prePulseBefore,
231 self.prePulseBefore,
225 self.prePulserAfter,
232 self.prePulserAfter,
226 self.rangeIpp,
233 self.rangeIpp,
227 self.rangeTxA,
234 self.rangeTxA,
228 self.rangeTxB)
235 self.rangeTxB)
229
236
230 header = numpy.array(headerTuple,self.struct)
237 header = numpy.array(headerTuple,self.struct)
231 header.tofile(fp)
238 header.tofile(fp)
232
239
233 dynamic = self.dynamic
240 dynamic = self.dynamic
234 dynamic.tofile(fp)
241 dynamic.tofile(fp)
235
242
236 return 1
243 return 1
237
244
238
245
239
246
240 class ProcessingHeader(Header):
247 class ProcessingHeader(Header):
241
248
242 size = None
249 size = None
243 dataType = None
250 dataType = None
244 blockSize = None
251 blockSize = None
245 profilesPerBlock = None
252 profilesPerBlock = None
246 dataBlocksPerFile = None
253 dataBlocksPerFile = None
247 numWindows = None
254 numWindows = None
248 processFlags = None
255 processFlags = None
249 coherentInt = None
256 coherentInt = None
250 incoherentInt = None
257 incoherentInt = None
251 totalSpectra = None
258 totalSpectra = None
252 struct = None
259 struct = None
253
260
254 def __init__(self):
261 def __init__(self):
255 self.size = 0
262 self.size = 0
256 self.dataType = 0
263 self.dataType = 0
257 self.blockSize = 0
264 self.blockSize = 0
258 self.profilesPerBlock = 0
265 self.profilesPerBlock = 0
259 self.dataBlocksPerFile = 0
266 self.dataBlocksPerFile = 0
260 self.numWindows = 0
267 self.numWindows = 0
261 self.processFlags = 0
268 self.processFlags = 0
262 self.coherentInt = 0
269 self.coherentInt = 0
263 self.incoherentInt = 0
270 self.incoherentInt = 0
264 self.totalSpectra = 0
271 self.totalSpectra = 0
265 self.struct = numpy.dtype([
272 self.struct = numpy.dtype([
266 ('nSize','<u4'),
273 ('nSize','<u4'),
267 ('nDataType','<u4'),
274 ('nDataType','<u4'),
268 ('nSizeOfDataBlock','<u4'),
275 ('nSizeOfDataBlock','<u4'),
269 ('nProfilesperBlock','<u4'),
276 ('nProfilesperBlock','<u4'),
270 ('nDataBlocksperFile','<u4'),
277 ('nDataBlocksperFile','<u4'),
271 ('nNumWindows','<u4'),
278 ('nNumWindows','<u4'),
272 ('nProcessFlags','<u4'),
279 ('nProcessFlags','<u4'),
273 ('nCoherentIntegrations','<u4'),
280 ('nCoherentIntegrations','<u4'),
274 ('nIncoherentIntegrations','<u4'),
281 ('nIncoherentIntegrations','<u4'),
275 ('nTotalSpectra','<u4')
282 ('nTotalSpectra','<u4')
276 ])
283 ])
277 self.samplingWindow = 0
284 self.samplingWindow = 0
278 self.structSamplingWindow = numpy.dtype([('h0','<f4'),('dh','<f4'),('nsa','<u4')])
285 self.structSamplingWindow = numpy.dtype([('h0','<f4'),('dh','<f4'),('nsa','<u4')])
279 self.numHeights = 0
286 self.numHeights = 0
280 self.firstHeight = 0
287 self.firstHeight = 0
281 self.deltaHeight = 0
288 self.deltaHeight = 0
282 self.samplesWin = 0
289 self.samplesWin = 0
283 self.spectraComb = 0
290 self.spectraComb = 0
284 self.numCode = 0
291 self.numCode = 0
285 self.codes = 0
292 self.codes = 0
286 self.numBaud = 0
293 self.numBaud = 0
287 self.shif_fft = False
294 self.shif_fft = False
288
295
289 def read(self, fp):
296 def read(self, fp):
290 header = numpy.fromfile(fp,self.struct,1)
297 try:
291 self.size = header['nSize'][0]
298 header = numpy.fromfile(fp,self.struct,1)
292 self.dataType = header['nDataType'][0]
299 self.size = header['nSize'][0]
293 self.blockSize = header['nSizeOfDataBlock'][0]
300 self.dataType = header['nDataType'][0]
294 self.profilesPerBlock = header['nProfilesperBlock'][0]
301 self.blockSize = header['nSizeOfDataBlock'][0]
295 self.dataBlocksPerFile = header['nDataBlocksperFile'][0]
302 self.profilesPerBlock = header['nProfilesperBlock'][0]
296 self.numWindows = header['nNumWindows'][0]
303 self.dataBlocksPerFile = header['nDataBlocksperFile'][0]
297 self.processFlags = header['nProcessFlags']
304 self.numWindows = header['nNumWindows'][0]
298 self.coherentInt = header['nCoherentIntegrations'][0]
305 self.processFlags = header['nProcessFlags']
299 self.incoherentInt = header['nIncoherentIntegrations'][0]
306 self.coherentInt = header['nCoherentIntegrations'][0]
300 self.totalSpectra = header['nTotalSpectra'][0]
307 self.incoherentInt = header['nIncoherentIntegrations'][0]
301 self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.numWindows)
308 self.totalSpectra = header['nTotalSpectra'][0]
302 self.numHeights = numpy.sum(self.samplingWindow['nsa'])
309 self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.numWindows)
303 self.firstHeight = self.samplingWindow['h0']
310 self.numHeights = numpy.sum(self.samplingWindow['nsa'])
304 self.deltaHeight = self.samplingWindow['dh']
311 self.firstHeight = self.samplingWindow['h0']
305 self.samplesWin = self.samplingWindow['nsa']
312 self.deltaHeight = self.samplingWindow['dh']
306 self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra)
313 self.samplesWin = self.samplingWindow['nsa']
307
314 self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra)
308 if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
315
309 self.numCode = numpy.fromfile(fp,'<u4',1)
316 if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
310 self.numBaud = numpy.fromfile(fp,'<u4',1)
317 self.numCode = numpy.fromfile(fp,'<u4',1)
311 self.codes = numpy.fromfile(fp,'<f4',self.numCode*self.numBaud).reshape(self.numBaud,self.numCode)
318 self.numBaud = numpy.fromfile(fp,'<u4',1)
312
319 self.codes = numpy.fromfile(fp,'<f4',self.numCode*self.numBaud).reshape(self.numBaud,self.numCode)
313 if self.processFlags & PROCFLAG.SHIFT_FFT_DATA == PROCFLAG.SHIFT_FFT_DATA:
314 self.shif_fft = True
315 else:
316 self.shif_fft = False
317
320
321 if self.processFlags & PROCFLAG.SHIFT_FFT_DATA == PROCFLAG.SHIFT_FFT_DATA:
322 self.shif_fft = True
323 else:
324 self.shif_fft = False
325 except:
326 return 0
318
327
319 return 1
328 return 1
320
329
321 def write(self, fp):
330 def write(self, fp):
322 headerTuple = (self.size,
331 headerTuple = (self.size,
323 self.dataType,
332 self.dataType,
324 self.blockSize,
333 self.blockSize,
325 self.profilesPerBlock,
334 self.profilesPerBlock,
326 self.dataBlocksPerFile,
335 self.dataBlocksPerFile,
327 self.numWindows,
336 self.numWindows,
328 self.processFlags,
337 self.processFlags,
329 self.coherentInt,
338 self.coherentInt,
330 self.incoherentInt,
339 self.incoherentInt,
331 self.totalSpectra)
340 self.totalSpectra)
332
341
333 header = numpy.array(headerTuple,self.struct)
342 header = numpy.array(headerTuple,self.struct)
334 header.tofile(fp)
343 header.tofile(fp)
335
344
336 if self.numWindows != 0:
345 if self.numWindows != 0:
337 sampleWindowTuple = (self.firstHeight,self.deltaHeight,self.samplesWin)
346 sampleWindowTuple = (self.firstHeight,self.deltaHeight,self.samplesWin)
338 samplingWindow = numpy.array(sampleWindowTuple,self.structSamplingWindow)
347 samplingWindow = numpy.array(sampleWindowTuple,self.structSamplingWindow)
339 samplingWindow.tofile(fp)
348 samplingWindow.tofile(fp)
340
349
341
350
342 if self.totalSpectra != 0:
351 if self.totalSpectra != 0:
343 spectraComb = numpy.array([],numpy.dtype('u1'))
352 spectraComb = numpy.array([],numpy.dtype('u1'))
344 spectraComb = self.spectraComb
353 spectraComb = self.spectraComb
345 spectraComb.tofile(fp)
354 spectraComb.tofile(fp)
346
355
347
356
348 if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
357 if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
349 numCode = self.numCode
358 numCode = self.numCode
350 numCode.tofile(fp)
359 numCode.tofile(fp)
351
360
352 numBaud = self.numBaud
361 numBaud = self.numBaud
353 numBaud.tofile(fp)
362 numBaud.tofile(fp)
354
363
355 codes = self.codes.reshape(numCode*numBaud)
364 codes = self.codes.reshape(numCode*numBaud)
356 codes.tofile(fp)
365 codes.tofile(fp)
357
366
358 return 1
367 return 1
359
368
360
369
361 class PROCFLAG:
370 class PROCFLAG:
362 COHERENT_INTEGRATION = numpy.uint32(0x00000001)
371 COHERENT_INTEGRATION = numpy.uint32(0x00000001)
363 DECODE_DATA = numpy.uint32(0x00000002)
372 DECODE_DATA = numpy.uint32(0x00000002)
364 SPECTRA_CALC = numpy.uint32(0x00000004)
373 SPECTRA_CALC = numpy.uint32(0x00000004)
365 INCOHERENT_INTEGRATION = numpy.uint32(0x00000008)
374 INCOHERENT_INTEGRATION = numpy.uint32(0x00000008)
366 POST_COHERENT_INTEGRATION = numpy.uint32(0x00000010)
375 POST_COHERENT_INTEGRATION = numpy.uint32(0x00000010)
367 SHIFT_FFT_DATA = numpy.uint32(0x00000020)
376 SHIFT_FFT_DATA = numpy.uint32(0x00000020)
368
377
369 DATATYPE_CHAR = numpy.uint32(0x00000040)
378 DATATYPE_CHAR = numpy.uint32(0x00000040)
370 DATATYPE_SHORT = numpy.uint32(0x00000080)
379 DATATYPE_SHORT = numpy.uint32(0x00000080)
371 DATATYPE_LONG = numpy.uint32(0x00000100)
380 DATATYPE_LONG = numpy.uint32(0x00000100)
372 DATATYPE_INT64 = numpy.uint32(0x00000200)
381 DATATYPE_INT64 = numpy.uint32(0x00000200)
373 DATATYPE_FLOAT = numpy.uint32(0x00000400)
382 DATATYPE_FLOAT = numpy.uint32(0x00000400)
374 DATATYPE_DOUBLE = numpy.uint32(0x00000800)
383 DATATYPE_DOUBLE = numpy.uint32(0x00000800)
375
384
376 DATAARRANGE_CONTIGUOUS_CH = numpy.uint32(0x00001000)
385 DATAARRANGE_CONTIGUOUS_CH = numpy.uint32(0x00001000)
377 DATAARRANGE_CONTIGUOUS_H = numpy.uint32(0x00002000)
386 DATAARRANGE_CONTIGUOUS_H = numpy.uint32(0x00002000)
378 DATAARRANGE_CONTIGUOUS_P = numpy.uint32(0x00004000)
387 DATAARRANGE_CONTIGUOUS_P = numpy.uint32(0x00004000)
379
388
380 SAVE_CHANNELS_DC = numpy.uint32(0x00008000)
389 SAVE_CHANNELS_DC = numpy.uint32(0x00008000)
381 DEFLIP_DATA = numpy.uint32(0x00010000)
390 DEFLIP_DATA = numpy.uint32(0x00010000)
382 DEFINE_PROCESS_CODE = numpy.uint32(0x00020000)
391 DEFINE_PROCESS_CODE = numpy.uint32(0x00020000)
383
392
384 ACQ_SYS_NATALIA = numpy.uint32(0x00040000)
393 ACQ_SYS_NATALIA = numpy.uint32(0x00040000)
385 ACQ_SYS_ECHOTEK = numpy.uint32(0x00080000)
394 ACQ_SYS_ECHOTEK = numpy.uint32(0x00080000)
386 ACQ_SYS_ADRXD = numpy.uint32(0x000C0000)
395 ACQ_SYS_ADRXD = numpy.uint32(0x000C0000)
387 ACQ_SYS_JULIA = numpy.uint32(0x00100000)
396 ACQ_SYS_JULIA = numpy.uint32(0x00100000)
388 ACQ_SYS_XXXXXX = numpy.uint32(0x00140000)
397 ACQ_SYS_XXXXXX = numpy.uint32(0x00140000)
389
398
390 EXP_NAME_ESP = numpy.uint32(0x00200000)
399 EXP_NAME_ESP = numpy.uint32(0x00200000)
391 CHANNEL_NAMES_ESP = numpy.uint32(0x00400000)
400 CHANNEL_NAMES_ESP = numpy.uint32(0x00400000)
392
401
393 OPERATION_MASK = numpy.uint32(0x0000003F)
402 OPERATION_MASK = numpy.uint32(0x0000003F)
394 DATATYPE_MASK = numpy.uint32(0x00000FC0)
403 DATATYPE_MASK = numpy.uint32(0x00000FC0)
395 DATAARRANGE_MASK = numpy.uint32(0x00007000)
404 DATAARRANGE_MASK = numpy.uint32(0x00007000)
396 ACQ_SYS_MASK = numpy.uint32(0x001C0000) No newline at end of file
405 ACQ_SYS_MASK = numpy.uint32(0x001C0000)
@@ -1,54 +1,57
1 '''
1 '''
2 Created on Feb 7, 2012
2 Created on Feb 7, 2012
3
3
4 @author $Author$
4 @author $Author$
5 @version $Id$
5 @version $Id$
6 '''
6 '''
7
7
8 from JROData import JROData, Noise
8 from JROData import JROData, Noise
9 from JROHeader import RadarControllerHeader, ProcessingHeader, SystemHeader, BasicHeader
9 from JROHeader import RadarControllerHeader, ProcessingHeader, SystemHeader, BasicHeader
10
10
11 class Spectra(JROData):
11 class Spectra(JROData):
12 '''
12 '''
13 classdocs
13 classdocs
14 '''
14 '''
15
15
16 type = "Spectra"
16 data_spc = None
17 data_spc = None
17 data_cspc = None
18 data_cspc = None
18 data_dc = None
19 data_dc = None
19 nPairs = 0
20 nPairs = 0
20
21
21
22
22 def __init__(self):
23 def __init__(self):
23 '''
24 '''
24 Constructor
25 Constructor
25 '''
26 '''
26
27
27 self.m_RadarControllerHeader = RadarControllerHeader()
28 self.m_RadarControllerHeader = RadarControllerHeader()
28
29
29 self.m_ProcessingHeader = ProcessingHeader()
30 self.m_ProcessingHeader = ProcessingHeader()
30
31
31 self.m_SystemHeader = SystemHeader()
32 self.m_SystemHeader = SystemHeader()
32
33
33 self.m_BasicHeader = BasicHeader()
34 self.m_BasicHeader = BasicHeader()
34
35
35 self.noise = Noise()
36 m_NoiseObj = Noise()
36
37
37 #data es un numpy array de 3 dmensiones (perfiles, alturas y canales)
38 #data es un numpy array de 3 dmensiones (perfiles, alturas y canales)
38 self.data_spc = None
39 self.data_spc = None
40
39 self.data_cspc = None
41 self.data_cspc = None
42
40 self.data_dc = None
43 self.data_dc = None
41
44
42 self.heights = None
45 self.heights = None
43
46
44 self.flagNoData = True
47 self.flagNoData = True
45
48
46 self.nProfiles = None
49 self.nProfiles = None
47
50
48 self.dataType = None
51 self.dataType = None
49
52
50 self.flagResetProcessing = False
53 self.flagResetProcessing = False
51
54
52 self.nPairs = 0
55 self.nPairs = 0
53
56
54 self.nChannels = 0 No newline at end of file
57 self.nChannels = 0
@@ -1,48 +1,49
1 '''
1 '''
2 Created on Feb 7, 2012
2 Created on Feb 7, 2012
3
3
4 @author $Author$
4 @author $Author$
5 @version $Id$
5 @version $Id$
6 '''
6 '''
7
7
8 from JROData import JROData, Noise
8 from JROData import JROData, Noise
9 from JROHeader import RadarControllerHeader, ProcessingHeader, SystemHeader, BasicHeader
9 from JROHeader import RadarControllerHeader, ProcessingHeader, SystemHeader, BasicHeader
10
10
11 class Voltage(JROData):
11 class Voltage(JROData):
12 '''
12 '''
13 classdocs
13 classdocs
14 '''
14 '''
15
15
16 type = "Voltage"
16 data = None
17 data = None
17 profileIndex = None
18 profileIndex = None
18
19
19 def __init__(self):
20 def __init__(self):
20 '''
21 '''
21 Constructor
22 Constructor
22 '''
23 '''
23
24
24 self.m_RadarControllerHeader= RadarControllerHeader()
25 self.m_RadarControllerHeader= RadarControllerHeader()
25
26
26 self.m_ProcessingHeader= ProcessingHeader()
27 self.m_ProcessingHeader= ProcessingHeader()
27
28
28 self.m_SystemHeader= SystemHeader()
29 self.m_SystemHeader= SystemHeader()
29
30
30 self.m_BasicHeader= BasicHeader()
31 self.m_BasicHeader= BasicHeader()
31
32
32 self.noise = Noise()
33 m_NoiseObj = Noise()
33
34
34 #data es un numpy array de 3 dmensiones (perfiles, alturas y canales)
35 #data es un numpy array de 3 dmensiones (perfiles, alturas y canales)
35 self.data = None
36 self.data = None
36
37
37 self.dataType = None
38 self.dataType = None
38
39
39 self.heights = None
40 self.heights = None
40
41
41 self.profileIndex = None
42 self.profileIndex = None
42
43
43 self.nProfiles = None
44 self.nProfiles = None
44
45
45 self.flagNoData = True
46 self.flagNoData = True
46
47
47 self.flagResetProcessing = False
48 self.flagResetProcessing = False
48 No newline at end of file
49
General Comments 0
You need to be logged in to leave comments. Login now