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