@@ -1,1132 +1,1132 | |||||
1 | ''' |
|
1 | ''' | |
2 |
|
2 | |||
3 | $Author: murco $ |
|
3 | $Author: murco $ | |
4 | $Id: JROData.py 173 2012-11-20 15:06:21Z murco $ |
|
4 | $Id: JROData.py 173 2012-11-20 15:06:21Z murco $ | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 | import copy |
|
7 | import copy | |
8 | import numpy |
|
8 | import numpy | |
9 | import datetime |
|
9 | import datetime | |
10 |
|
10 | |||
11 | from jroheaderIO import SystemHeader, RadarControllerHeader |
|
11 | from jroheaderIO import SystemHeader, RadarControllerHeader | |
12 |
|
12 | |||
13 | def getNumpyDtype(dataTypeCode): |
|
13 | def getNumpyDtype(dataTypeCode): | |
14 |
|
14 | |||
15 | if dataTypeCode == 0: |
|
15 | if dataTypeCode == 0: | |
16 | numpyDtype = numpy.dtype([('real','<i1'),('imag','<i1')]) |
|
16 | numpyDtype = numpy.dtype([('real','<i1'),('imag','<i1')]) | |
17 | elif dataTypeCode == 1: |
|
17 | elif dataTypeCode == 1: | |
18 | numpyDtype = numpy.dtype([('real','<i2'),('imag','<i2')]) |
|
18 | numpyDtype = numpy.dtype([('real','<i2'),('imag','<i2')]) | |
19 | elif dataTypeCode == 2: |
|
19 | elif dataTypeCode == 2: | |
20 | numpyDtype = numpy.dtype([('real','<i4'),('imag','<i4')]) |
|
20 | numpyDtype = numpy.dtype([('real','<i4'),('imag','<i4')]) | |
21 | elif dataTypeCode == 3: |
|
21 | elif dataTypeCode == 3: | |
22 | numpyDtype = numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
22 | numpyDtype = numpy.dtype([('real','<i8'),('imag','<i8')]) | |
23 | elif dataTypeCode == 4: |
|
23 | elif dataTypeCode == 4: | |
24 | numpyDtype = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
24 | numpyDtype = numpy.dtype([('real','<f4'),('imag','<f4')]) | |
25 | elif dataTypeCode == 5: |
|
25 | elif dataTypeCode == 5: | |
26 | numpyDtype = numpy.dtype([('real','<f8'),('imag','<f8')]) |
|
26 | numpyDtype = numpy.dtype([('real','<f8'),('imag','<f8')]) | |
27 | else: |
|
27 | else: | |
28 | raise ValueError, 'dataTypeCode was not defined' |
|
28 | raise ValueError, 'dataTypeCode was not defined' | |
29 |
|
29 | |||
30 | return numpyDtype |
|
30 | return numpyDtype | |
31 |
|
31 | |||
32 | def getDataTypeCode(numpyDtype): |
|
32 | def getDataTypeCode(numpyDtype): | |
33 |
|
33 | |||
34 | if numpyDtype == numpy.dtype([('real','<i1'),('imag','<i1')]): |
|
34 | if numpyDtype == numpy.dtype([('real','<i1'),('imag','<i1')]): | |
35 | datatype = 0 |
|
35 | datatype = 0 | |
36 | elif numpyDtype == numpy.dtype([('real','<i2'),('imag','<i2')]): |
|
36 | elif numpyDtype == numpy.dtype([('real','<i2'),('imag','<i2')]): | |
37 | datatype = 1 |
|
37 | datatype = 1 | |
38 | elif numpyDtype == numpy.dtype([('real','<i4'),('imag','<i4')]): |
|
38 | elif numpyDtype == numpy.dtype([('real','<i4'),('imag','<i4')]): | |
39 | datatype = 2 |
|
39 | datatype = 2 | |
40 | elif numpyDtype == numpy.dtype([('real','<i8'),('imag','<i8')]): |
|
40 | elif numpyDtype == numpy.dtype([('real','<i8'),('imag','<i8')]): | |
41 | datatype = 3 |
|
41 | datatype = 3 | |
42 | elif numpyDtype == numpy.dtype([('real','<f4'),('imag','<f4')]): |
|
42 | elif numpyDtype == numpy.dtype([('real','<f4'),('imag','<f4')]): | |
43 | datatype = 4 |
|
43 | datatype = 4 | |
44 | elif numpyDtype == numpy.dtype([('real','<f8'),('imag','<f8')]): |
|
44 | elif numpyDtype == numpy.dtype([('real','<f8'),('imag','<f8')]): | |
45 | datatype = 5 |
|
45 | datatype = 5 | |
46 | else: |
|
46 | else: | |
47 | datatype = None |
|
47 | datatype = None | |
48 |
|
48 | |||
49 | return datatype |
|
49 | return datatype | |
50 |
|
50 | |||
51 | def hildebrand_sekhon(data, navg): |
|
51 | def hildebrand_sekhon(data, navg): | |
52 | """ |
|
52 | """ | |
53 | This method is for the objective determination of the noise level in Doppler spectra. This |
|
53 | This method is for the objective determination of the noise level in Doppler spectra. This | |
54 | implementation technique is based on the fact that the standard deviation of the spectral |
|
54 | implementation technique is based on the fact that the standard deviation of the spectral | |
55 | densities is equal to the mean spectral density for white Gaussian noise |
|
55 | densities is equal to the mean spectral density for white Gaussian noise | |
56 |
|
56 | |||
57 | Inputs: |
|
57 | Inputs: | |
58 | Data : heights |
|
58 | Data : heights | |
59 | navg : numbers of averages |
|
59 | navg : numbers of averages | |
60 |
|
60 | |||
61 | Return: |
|
61 | Return: | |
62 | -1 : any error |
|
62 | -1 : any error | |
63 | anoise : noise's level |
|
63 | anoise : noise's level | |
64 | """ |
|
64 | """ | |
65 |
|
65 | |||
66 | sortdata = numpy.sort(data,axis=None) |
|
66 | sortdata = numpy.sort(data,axis=None) | |
67 | lenOfData = len(sortdata) |
|
67 | lenOfData = len(sortdata) | |
68 | nums_min = lenOfData/10 |
|
68 | nums_min = lenOfData/10 | |
69 |
|
69 | |||
70 | if (lenOfData/10) > 2: |
|
70 | if (lenOfData/10) > 2: | |
71 | nums_min = lenOfData/10 |
|
71 | nums_min = lenOfData/10 | |
72 | else: |
|
72 | else: | |
73 | nums_min = 2 |
|
73 | nums_min = 2 | |
74 |
|
74 | |||
75 | sump = 0. |
|
75 | sump = 0. | |
76 |
|
76 | |||
77 | sumq = 0. |
|
77 | sumq = 0. | |
78 |
|
78 | |||
79 | j = 0 |
|
79 | j = 0 | |
80 |
|
80 | |||
81 | cont = 1 |
|
81 | cont = 1 | |
82 |
|
82 | |||
83 | while((cont==1)and(j<lenOfData)): |
|
83 | while((cont==1)and(j<lenOfData)): | |
84 |
|
84 | |||
85 | sump += sortdata[j] |
|
85 | sump += sortdata[j] | |
86 |
|
86 | |||
87 | sumq += sortdata[j]**2 |
|
87 | sumq += sortdata[j]**2 | |
88 |
|
88 | |||
89 | if j > nums_min: |
|
89 | if j > nums_min: | |
90 | rtest = float(j)/(j-1) + 1.0/navg |
|
90 | rtest = float(j)/(j-1) + 1.0/navg | |
91 | if ((sumq*j) > (rtest*sump**2)): |
|
91 | if ((sumq*j) > (rtest*sump**2)): | |
92 | j = j - 1 |
|
92 | j = j - 1 | |
93 | sump = sump - sortdata[j] |
|
93 | sump = sump - sortdata[j] | |
94 | sumq = sumq - sortdata[j]**2 |
|
94 | sumq = sumq - sortdata[j]**2 | |
95 | cont = 0 |
|
95 | cont = 0 | |
96 |
|
96 | |||
97 | j += 1 |
|
97 | j += 1 | |
98 |
|
98 | |||
99 | lnoise = sump /j |
|
99 | lnoise = sump /j | |
100 | stdv = numpy.sqrt((sumq - lnoise**2)/(j - 1)) |
|
100 | stdv = numpy.sqrt((sumq - lnoise**2)/(j - 1)) | |
101 | return lnoise |
|
101 | return lnoise | |
102 |
|
102 | |||
103 | class Beam: |
|
103 | class Beam: | |
104 | def __init__(self): |
|
104 | def __init__(self): | |
105 | self.codeList = [] |
|
105 | self.codeList = [] | |
106 | self.azimuthList = [] |
|
106 | self.azimuthList = [] | |
107 | self.zenithList = [] |
|
107 | self.zenithList = [] | |
108 |
|
108 | |||
109 | class GenericData(object): |
|
109 | class GenericData(object): | |
110 |
|
110 | |||
111 | flagNoData = True |
|
111 | flagNoData = True | |
112 |
|
112 | |||
113 | def __init__(self): |
|
113 | def __init__(self): | |
114 |
|
114 | |||
115 | raise ValueError, "This class has not been implemented" |
|
115 | raise ValueError, "This class has not been implemented" | |
116 |
|
116 | |||
117 | def copy(self, inputObj=None): |
|
117 | def copy(self, inputObj=None): | |
118 |
|
118 | |||
119 | if inputObj == None: |
|
119 | if inputObj == None: | |
120 | return copy.deepcopy(self) |
|
120 | return copy.deepcopy(self) | |
121 |
|
121 | |||
122 | for key in inputObj.__dict__.keys(): |
|
122 | for key in inputObj.__dict__.keys(): | |
123 | self.__dict__[key] = inputObj.__dict__[key] |
|
123 | self.__dict__[key] = inputObj.__dict__[key] | |
124 |
|
124 | |||
125 | def deepcopy(self): |
|
125 | def deepcopy(self): | |
126 |
|
126 | |||
127 | return copy.deepcopy(self) |
|
127 | return copy.deepcopy(self) | |
128 |
|
128 | |||
129 | def isEmpty(self): |
|
129 | def isEmpty(self): | |
130 |
|
130 | |||
131 | return self.flagNoData |
|
131 | return self.flagNoData | |
132 |
|
132 | |||
133 | class JROData(GenericData): |
|
133 | class JROData(GenericData): | |
134 |
|
134 | |||
135 | # m_BasicHeader = BasicHeader() |
|
135 | # m_BasicHeader = BasicHeader() | |
136 | # m_ProcessingHeader = ProcessingHeader() |
|
136 | # m_ProcessingHeader = ProcessingHeader() | |
137 |
|
137 | |||
138 | systemHeaderObj = SystemHeader() |
|
138 | systemHeaderObj = SystemHeader() | |
139 |
|
139 | |||
140 | radarControllerHeaderObj = RadarControllerHeader() |
|
140 | radarControllerHeaderObj = RadarControllerHeader() | |
141 |
|
141 | |||
142 | # data = None |
|
142 | # data = None | |
143 |
|
143 | |||
144 | type = None |
|
144 | type = None | |
145 |
|
145 | |||
146 | datatype = None #dtype but in string |
|
146 | datatype = None #dtype but in string | |
147 |
|
147 | |||
148 | # dtype = None |
|
148 | # dtype = None | |
149 |
|
149 | |||
150 | # nChannels = None |
|
150 | # nChannels = None | |
151 |
|
151 | |||
152 | # nHeights = None |
|
152 | # nHeights = None | |
153 |
|
153 | |||
154 | nProfiles = None |
|
154 | nProfiles = None | |
155 |
|
155 | |||
156 | heightList = None |
|
156 | heightList = None | |
157 |
|
157 | |||
158 | channelList = None |
|
158 | channelList = None | |
159 |
|
159 | |||
160 | flagDiscontinuousBlock = False |
|
160 | flagDiscontinuousBlock = False | |
161 |
|
161 | |||
162 | useLocalTime = False |
|
162 | useLocalTime = False | |
163 |
|
163 | |||
164 | utctime = None |
|
164 | utctime = None | |
165 |
|
165 | |||
166 | timeZone = None |
|
166 | timeZone = None | |
167 |
|
167 | |||
168 | dstFlag = None |
|
168 | dstFlag = None | |
169 |
|
169 | |||
170 | errorCount = None |
|
170 | errorCount = None | |
171 |
|
171 | |||
172 | blocksize = None |
|
172 | blocksize = None | |
173 |
|
173 | |||
174 | # nCode = None |
|
174 | # nCode = None | |
175 | # |
|
175 | # | |
176 | # nBaud = None |
|
176 | # nBaud = None | |
177 | # |
|
177 | # | |
178 | # code = None |
|
178 | # code = None | |
179 |
|
179 | |||
180 | flagDecodeData = False #asumo q la data no esta decodificada |
|
180 | flagDecodeData = False #asumo q la data no esta decodificada | |
181 |
|
181 | |||
182 | flagDeflipData = False #asumo q la data no esta sin flip |
|
182 | flagDeflipData = False #asumo q la data no esta sin flip | |
183 |
|
183 | |||
184 | flagShiftFFT = False |
|
184 | flagShiftFFT = False | |
185 |
|
185 | |||
186 | # ippSeconds = None |
|
186 | # ippSeconds = None | |
187 |
|
187 | |||
188 | # timeInterval = None |
|
188 | # timeInterval = None | |
189 |
|
189 | |||
190 | nCohInt = None |
|
190 | nCohInt = None | |
191 |
|
191 | |||
192 | # noise = None |
|
192 | # noise = None | |
193 |
|
193 | |||
194 | windowOfFilter = 1 |
|
194 | windowOfFilter = 1 | |
195 |
|
195 | |||
196 | #Speed of ligth |
|
196 | #Speed of ligth | |
197 | C = 3e8 |
|
197 | C = 3e8 | |
198 |
|
198 | |||
199 | frequency = 49.92e6 |
|
199 | frequency = 49.92e6 | |
200 |
|
200 | |||
201 | realtime = False |
|
201 | realtime = False | |
202 |
|
202 | |||
203 | beacon_heiIndexList = None |
|
203 | beacon_heiIndexList = None | |
204 |
|
204 | |||
205 | last_block = None |
|
205 | last_block = None | |
206 |
|
206 | |||
207 | blocknow = None |
|
207 | blocknow = None | |
208 |
|
208 | |||
209 | azimuth = None |
|
209 | azimuth = None | |
210 |
|
210 | |||
211 | zenith = None |
|
211 | zenith = None | |
212 |
|
212 | |||
213 | beam = Beam() |
|
213 | beam = Beam() | |
214 |
|
214 | |||
215 | profileIndex = None |
|
215 | profileIndex = None | |
216 |
|
216 | |||
217 | def __init__(self): |
|
217 | def __init__(self): | |
218 |
|
218 | |||
219 | raise ValueError, "This class has not been implemented" |
|
219 | raise ValueError, "This class has not been implemented" | |
220 |
|
220 | |||
221 | def getNoise(self): |
|
221 | def getNoise(self): | |
222 |
|
222 | |||
223 | raise ValueError, "Not implemented" |
|
223 | raise ValueError, "Not implemented" | |
224 |
|
224 | |||
225 | def getNChannels(self): |
|
225 | def getNChannels(self): | |
226 |
|
226 | |||
227 | return len(self.channelList) |
|
227 | return len(self.channelList) | |
228 |
|
228 | |||
229 | def getChannelIndexList(self): |
|
229 | def getChannelIndexList(self): | |
230 |
|
230 | |||
231 | return range(self.nChannels) |
|
231 | return range(self.nChannels) | |
232 |
|
232 | |||
233 | def getNHeights(self): |
|
233 | def getNHeights(self): | |
234 |
|
234 | |||
235 | return len(self.heightList) |
|
235 | return len(self.heightList) | |
236 |
|
236 | |||
237 | def getHeiRange(self, extrapoints=0): |
|
237 | def getHeiRange(self, extrapoints=0): | |
238 |
|
238 | |||
239 | heis = self.heightList |
|
239 | heis = self.heightList | |
240 | # deltah = self.heightList[1] - self.heightList[0] |
|
240 | # deltah = self.heightList[1] - self.heightList[0] | |
241 | # |
|
241 | # | |
242 | # heis.append(self.heightList[-1]) |
|
242 | # heis.append(self.heightList[-1]) | |
243 |
|
243 | |||
244 | return heis |
|
244 | return heis | |
245 |
|
245 | |||
246 | def getltctime(self): |
|
246 | def getltctime(self): | |
247 |
|
247 | |||
248 | if self.useLocalTime: |
|
248 | if self.useLocalTime: | |
249 | return self.utctime - self.timeZone*60 |
|
249 | return self.utctime - self.timeZone*60 | |
250 |
|
250 | |||
251 | return self.utctime |
|
251 | return self.utctime | |
252 |
|
252 | |||
253 | def getDatatime(self): |
|
253 | def getDatatime(self): | |
254 |
|
254 | |||
255 | datatimeValue = datetime.datetime.utcfromtimestamp(self.ltctime) |
|
255 | datatimeValue = datetime.datetime.utcfromtimestamp(self.ltctime) | |
256 | return datatimeValue |
|
256 | return datatimeValue | |
257 |
|
257 | |||
258 | def getTimeRange(self): |
|
258 | def getTimeRange(self): | |
259 |
|
259 | |||
260 | datatime = [] |
|
260 | datatime = [] | |
261 |
|
261 | |||
262 | datatime.append(self.ltctime) |
|
262 | datatime.append(self.ltctime) | |
263 | datatime.append(self.ltctime + self.timeInterval+60) |
|
263 | datatime.append(self.ltctime + self.timeInterval+60) | |
264 |
|
264 | |||
265 | datatime = numpy.array(datatime) |
|
265 | datatime = numpy.array(datatime) | |
266 |
|
266 | |||
267 | return datatime |
|
267 | return datatime | |
268 |
|
268 | |||
269 | def getFmax(self): |
|
269 | def getFmax(self): | |
270 |
|
270 | |||
271 | PRF = 1./(self.ippSeconds * self.nCohInt) |
|
271 | PRF = 1./(self.ippSeconds * self.nCohInt) | |
272 |
|
272 | |||
273 | fmax = PRF/2. |
|
273 | fmax = PRF/2. | |
274 |
|
274 | |||
275 | return fmax |
|
275 | return fmax | |
276 |
|
276 | |||
277 | def getVmax(self): |
|
277 | def getVmax(self): | |
278 |
|
278 | |||
279 | _lambda = self.C/self.frequency |
|
279 | _lambda = self.C/self.frequency | |
280 |
|
280 | |||
281 | vmax = self.getFmax() * _lambda |
|
281 | vmax = self.getFmax() * _lambda | |
282 |
|
282 | |||
283 | return vmax |
|
283 | return vmax | |
284 |
|
284 | |||
285 | def get_ippSeconds(self): |
|
285 | def get_ippSeconds(self): | |
286 | ''' |
|
286 | ''' | |
287 | ''' |
|
287 | ''' | |
288 | return self.radarControllerHeaderObj.ippSeconds |
|
288 | return self.radarControllerHeaderObj.ippSeconds | |
289 |
|
289 | |||
290 | def set_ippSeconds(self, ippSeconds): |
|
290 | def set_ippSeconds(self, ippSeconds): | |
291 | ''' |
|
291 | ''' | |
292 | ''' |
|
292 | ''' | |
293 |
|
293 | |||
294 | self.radarControllerHeaderObj.ippSeconds = ippSeconds |
|
294 | self.radarControllerHeaderObj.ippSeconds = ippSeconds | |
295 |
|
295 | |||
296 | return |
|
296 | return | |
297 |
|
297 | |||
298 | def get_dtype(self): |
|
298 | def get_dtype(self): | |
299 | ''' |
|
299 | ''' | |
300 | ''' |
|
300 | ''' | |
301 | return getNumpyDtype(self.datatype) |
|
301 | return getNumpyDtype(self.datatype) | |
302 |
|
302 | |||
303 | def set_dtype(self, numpyDtype): |
|
303 | def set_dtype(self, numpyDtype): | |
304 | ''' |
|
304 | ''' | |
305 | ''' |
|
305 | ''' | |
306 |
|
306 | |||
307 | self.datatype = getDataTypeCode(numpyDtype) |
|
307 | self.datatype = getDataTypeCode(numpyDtype) | |
308 |
|
308 | |||
309 | def get_code(self): |
|
309 | def get_code(self): | |
310 | ''' |
|
310 | ''' | |
311 | ''' |
|
311 | ''' | |
312 | return self.radarControllerHeaderObj.code |
|
312 | return self.radarControllerHeaderObj.code | |
313 |
|
313 | |||
314 | def set_code(self, code): |
|
314 | def set_code(self, code): | |
315 | ''' |
|
315 | ''' | |
316 | ''' |
|
316 | ''' | |
317 | self.radarControllerHeaderObj.code = code |
|
317 | self.radarControllerHeaderObj.code = code | |
318 |
|
318 | |||
319 | return |
|
319 | return | |
320 |
|
320 | |||
321 | def get_ncode(self): |
|
321 | def get_ncode(self): | |
322 | ''' |
|
322 | ''' | |
323 | ''' |
|
323 | ''' | |
324 | return self.radarControllerHeaderObj.nCode |
|
324 | return self.radarControllerHeaderObj.nCode | |
325 |
|
325 | |||
326 | def set_ncode(self, nCode): |
|
326 | def set_ncode(self, nCode): | |
327 | ''' |
|
327 | ''' | |
328 | ''' |
|
328 | ''' | |
329 | self.radarControllerHeaderObj.nCode = nCode |
|
329 | self.radarControllerHeaderObj.nCode = nCode | |
330 |
|
330 | |||
331 | return |
|
331 | return | |
332 |
|
332 | |||
333 | def get_nbaud(self): |
|
333 | def get_nbaud(self): | |
334 | ''' |
|
334 | ''' | |
335 | ''' |
|
335 | ''' | |
336 | return self.radarControllerHeaderObj.nBaud |
|
336 | return self.radarControllerHeaderObj.nBaud | |
337 |
|
337 | |||
338 | def set_nbaud(self, nBaud): |
|
338 | def set_nbaud(self, nBaud): | |
339 | ''' |
|
339 | ''' | |
340 | ''' |
|
340 | ''' | |
341 | self.radarControllerHeaderObj.nBaud = nBaud |
|
341 | self.radarControllerHeaderObj.nBaud = nBaud | |
342 |
|
342 | |||
343 | return |
|
343 | return | |
344 | # def getTimeInterval(self): |
|
344 | # def getTimeInterval(self): | |
345 | # |
|
345 | # | |
346 | # raise IOError, "This method should be implemented inside each Class" |
|
346 | # raise IOError, "This method should be implemented inside each Class" | |
347 |
|
347 | |||
348 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
348 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") | |
349 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
349 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") | |
350 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
350 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
351 | #noise = property(getNoise, "I'm the 'nHeights' property.") |
|
351 | #noise = property(getNoise, "I'm the 'nHeights' property.") | |
352 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
352 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
353 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
353 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
354 | ippSeconds = property(get_ippSeconds, set_ippSeconds) |
|
354 | ippSeconds = property(get_ippSeconds, set_ippSeconds) | |
355 | dtype = property(get_dtype, set_dtype) |
|
355 | dtype = property(get_dtype, set_dtype) | |
356 | # timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
356 | # timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
357 | code = property(get_code, set_code) |
|
357 | code = property(get_code, set_code) | |
358 | nCode = property(get_ncode, set_ncode) |
|
358 | nCode = property(get_ncode, set_ncode) | |
359 | nBaud = property(get_nbaud, set_nbaud) |
|
359 | nBaud = property(get_nbaud, set_nbaud) | |
360 |
|
360 | |||
361 | class Voltage(JROData): |
|
361 | class Voltage(JROData): | |
362 |
|
362 | |||
363 | #data es un numpy array de 2 dmensiones (canales, alturas) |
|
363 | #data es un numpy array de 2 dmensiones (canales, alturas) | |
364 | data = None |
|
364 | data = None | |
365 |
|
365 | |||
366 | def __init__(self): |
|
366 | def __init__(self): | |
367 | ''' |
|
367 | ''' | |
368 | Constructor |
|
368 | Constructor | |
369 | ''' |
|
369 | ''' | |
370 |
|
370 | |||
371 | self.useLocalTime = True |
|
371 | self.useLocalTime = True | |
372 |
|
372 | |||
373 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
373 | self.radarControllerHeaderObj = RadarControllerHeader() | |
374 |
|
374 | |||
375 | self.systemHeaderObj = SystemHeader() |
|
375 | self.systemHeaderObj = SystemHeader() | |
376 |
|
376 | |||
377 | self.type = "Voltage" |
|
377 | self.type = "Voltage" | |
378 |
|
378 | |||
379 | self.data = None |
|
379 | self.data = None | |
380 |
|
380 | |||
381 | # self.dtype = None |
|
381 | # self.dtype = None | |
382 |
|
382 | |||
383 | # self.nChannels = 0 |
|
383 | # self.nChannels = 0 | |
384 |
|
384 | |||
385 | # self.nHeights = 0 |
|
385 | # self.nHeights = 0 | |
386 |
|
386 | |||
387 | self.nProfiles = None |
|
387 | self.nProfiles = None | |
388 |
|
388 | |||
389 | self.heightList = None |
|
389 | self.heightList = None | |
390 |
|
390 | |||
391 | self.channelList = None |
|
391 | self.channelList = None | |
392 |
|
392 | |||
393 | # self.channelIndexList = None |
|
393 | # self.channelIndexList = None | |
394 |
|
394 | |||
395 | self.flagNoData = True |
|
395 | self.flagNoData = True | |
396 |
|
396 | |||
397 | self.flagDiscontinuousBlock = False |
|
397 | self.flagDiscontinuousBlock = False | |
398 |
|
398 | |||
399 | self.utctime = None |
|
399 | self.utctime = None | |
400 |
|
400 | |||
401 | self.timeZone = None |
|
401 | self.timeZone = None | |
402 |
|
402 | |||
403 | self.dstFlag = None |
|
403 | self.dstFlag = None | |
404 |
|
404 | |||
405 | self.errorCount = None |
|
405 | self.errorCount = None | |
406 |
|
406 | |||
407 | self.nCohInt = None |
|
407 | self.nCohInt = None | |
408 |
|
408 | |||
409 | self.blocksize = None |
|
409 | self.blocksize = None | |
410 |
|
410 | |||
411 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
411 | self.flagDecodeData = False #asumo q la data no esta decodificada | |
412 |
|
412 | |||
413 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
413 | self.flagDeflipData = False #asumo q la data no esta sin flip | |
414 |
|
414 | |||
415 | self.flagShiftFFT = False |
|
415 | self.flagShiftFFT = False | |
416 |
|
416 | |||
417 | self.flagDataAsBlock = False #Asumo que la data es leida perfil a perfil |
|
417 | self.flagDataAsBlock = False #Asumo que la data es leida perfil a perfil | |
418 |
|
418 | |||
419 | self.profileIndex = 0 |
|
419 | self.profileIndex = 0 | |
420 |
|
420 | |||
421 | def getNoisebyHildebrand(self, channel = None): |
|
421 | def getNoisebyHildebrand(self, channel = None): | |
422 | """ |
|
422 | """ | |
423 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon |
|
423 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon | |
424 |
|
424 | |||
425 | Return: |
|
425 | Return: | |
426 | noiselevel |
|
426 | noiselevel | |
427 | """ |
|
427 | """ | |
428 |
|
428 | |||
429 | if channel != None: |
|
429 | if channel != None: | |
430 | data = self.data[channel] |
|
430 | data = self.data[channel] | |
431 | nChannels = 1 |
|
431 | nChannels = 1 | |
432 | else: |
|
432 | else: | |
433 | data = self.data |
|
433 | data = self.data | |
434 | nChannels = self.nChannels |
|
434 | nChannels = self.nChannels | |
435 |
|
435 | |||
436 | noise = numpy.zeros(nChannels) |
|
436 | noise = numpy.zeros(nChannels) | |
437 | power = data * numpy.conjugate(data) |
|
437 | power = data * numpy.conjugate(data) | |
438 |
|
438 | |||
439 | for thisChannel in range(nChannels): |
|
439 | for thisChannel in range(nChannels): | |
440 | if nChannels == 1: |
|
440 | if nChannels == 1: | |
441 | daux = power[:].real |
|
441 | daux = power[:].real | |
442 | else: |
|
442 | else: | |
443 | daux = power[thisChannel,:].real |
|
443 | daux = power[thisChannel,:].real | |
444 | noise[thisChannel] = hildebrand_sekhon(daux, self.nCohInt) |
|
444 | noise[thisChannel] = hildebrand_sekhon(daux, self.nCohInt) | |
445 |
|
445 | |||
446 | return noise |
|
446 | return noise | |
447 |
|
447 | |||
448 | def getNoise(self, type = 1, channel = None): |
|
448 | def getNoise(self, type = 1, channel = None): | |
449 |
|
449 | |||
450 | if type == 1: |
|
450 | if type == 1: | |
451 | noise = self.getNoisebyHildebrand(channel) |
|
451 | noise = self.getNoisebyHildebrand(channel) | |
452 |
|
452 | |||
453 | return 10*numpy.log10(noise) |
|
453 | return 10*numpy.log10(noise) | |
454 |
|
454 | |||
455 | def getPower(self, channel = None): |
|
455 | def getPower(self, channel = None): | |
456 |
|
456 | |||
457 | if channel != None: |
|
457 | if channel != None: | |
458 | data = self.data[channel] |
|
458 | data = self.data[channel] | |
459 | else: |
|
459 | else: | |
460 | data = self.data |
|
460 | data = self.data | |
461 |
|
461 | |||
462 | power = data * numpy.conjugate(data) |
|
462 | power = data * numpy.conjugate(data) | |
463 |
|
463 | |||
464 | return 10*numpy.log10(power.real) |
|
464 | return 10*numpy.log10(power.real) | |
465 |
|
465 | |||
466 | def getTimeInterval(self): |
|
466 | def getTimeInterval(self): | |
467 |
|
467 | |||
468 | timeInterval = self.ippSeconds * self.nCohInt |
|
468 | timeInterval = self.ippSeconds * self.nCohInt | |
469 |
|
469 | |||
470 | return timeInterval |
|
470 | return timeInterval | |
471 |
|
471 | |||
472 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
472 | noise = property(getNoise, "I'm the 'nHeights' property.") | |
473 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
473 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
474 |
|
474 | |||
475 | class Spectra(JROData): |
|
475 | class Spectra(JROData): | |
476 |
|
476 | |||
477 | #data es un numpy array de 2 dmensiones (canales, perfiles, alturas) |
|
477 | #data es un numpy array de 2 dmensiones (canales, perfiles, alturas) | |
478 | data_spc = None |
|
478 | data_spc = None | |
479 |
|
479 | |||
480 | #data es un numpy array de 2 dmensiones (canales, pares, alturas) |
|
480 | #data es un numpy array de 2 dmensiones (canales, pares, alturas) | |
481 | data_cspc = None |
|
481 | data_cspc = None | |
482 |
|
482 | |||
483 | #data es un numpy array de 2 dmensiones (canales, alturas) |
|
483 | #data es un numpy array de 2 dmensiones (canales, alturas) | |
484 | data_dc = None |
|
484 | data_dc = None | |
485 |
|
485 | |||
486 | nFFTPoints = None |
|
486 | nFFTPoints = None | |
487 |
|
487 | |||
488 | # nPairs = None |
|
488 | # nPairs = None | |
489 |
|
489 | |||
490 | pairsList = None |
|
490 | pairsList = None | |
491 |
|
491 | |||
492 | nIncohInt = None |
|
492 | nIncohInt = None | |
493 |
|
493 | |||
494 | wavelength = None #Necesario para cacular el rango de velocidad desde la frecuencia |
|
494 | wavelength = None #Necesario para cacular el rango de velocidad desde la frecuencia | |
495 |
|
495 | |||
496 | nCohInt = None #se requiere para determinar el valor de timeInterval |
|
496 | nCohInt = None #se requiere para determinar el valor de timeInterval | |
497 |
|
497 | |||
498 | ippFactor = None |
|
498 | ippFactor = None | |
499 |
|
499 | |||
500 | profileIndex = 0 |
|
500 | profileIndex = 0 | |
501 |
|
501 | |||
502 | def __init__(self): |
|
502 | def __init__(self): | |
503 | ''' |
|
503 | ''' | |
504 | Constructor |
|
504 | Constructor | |
505 | ''' |
|
505 | ''' | |
506 |
|
506 | |||
507 | self.useLocalTime = True |
|
507 | self.useLocalTime = True | |
508 |
|
508 | |||
509 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
509 | self.radarControllerHeaderObj = RadarControllerHeader() | |
510 |
|
510 | |||
511 | self.systemHeaderObj = SystemHeader() |
|
511 | self.systemHeaderObj = SystemHeader() | |
512 |
|
512 | |||
513 | self.type = "Spectra" |
|
513 | self.type = "Spectra" | |
514 |
|
514 | |||
515 | # self.data = None |
|
515 | # self.data = None | |
516 |
|
516 | |||
517 | # self.dtype = None |
|
517 | # self.dtype = None | |
518 |
|
518 | |||
519 | # self.nChannels = 0 |
|
519 | # self.nChannels = 0 | |
520 |
|
520 | |||
521 | # self.nHeights = 0 |
|
521 | # self.nHeights = 0 | |
522 |
|
522 | |||
523 | self.nProfiles = None |
|
523 | self.nProfiles = None | |
524 |
|
524 | |||
525 | self.heightList = None |
|
525 | self.heightList = None | |
526 |
|
526 | |||
527 | self.channelList = None |
|
527 | self.channelList = None | |
528 |
|
528 | |||
529 | # self.channelIndexList = None |
|
529 | # self.channelIndexList = None | |
530 |
|
530 | |||
531 | self.pairsList = None |
|
531 | self.pairsList = None | |
532 |
|
532 | |||
533 | self.flagNoData = True |
|
533 | self.flagNoData = True | |
534 |
|
534 | |||
535 | self.flagDiscontinuousBlock = False |
|
535 | self.flagDiscontinuousBlock = False | |
536 |
|
536 | |||
537 | self.utctime = None |
|
537 | self.utctime = None | |
538 |
|
538 | |||
539 | self.nCohInt = None |
|
539 | self.nCohInt = None | |
540 |
|
540 | |||
541 | self.nIncohInt = None |
|
541 | self.nIncohInt = None | |
542 |
|
542 | |||
543 | self.blocksize = None |
|
543 | self.blocksize = None | |
544 |
|
544 | |||
545 | self.nFFTPoints = None |
|
545 | self.nFFTPoints = None | |
546 |
|
546 | |||
547 | self.wavelength = None |
|
547 | self.wavelength = None | |
548 |
|
548 | |||
549 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
549 | self.flagDecodeData = False #asumo q la data no esta decodificada | |
550 |
|
550 | |||
551 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
551 | self.flagDeflipData = False #asumo q la data no esta sin flip | |
552 |
|
552 | |||
553 | self.flagShiftFFT = False |
|
553 | self.flagShiftFFT = False | |
554 |
|
554 | |||
555 | self.ippFactor = 1 |
|
555 | self.ippFactor = 1 | |
556 |
|
556 | |||
557 | #self.noise = None |
|
557 | #self.noise = None | |
558 |
|
558 | |||
559 | self.beacon_heiIndexList = [] |
|
559 | self.beacon_heiIndexList = [] | |
560 |
|
560 | |||
561 | self.noise_estimation = None |
|
561 | self.noise_estimation = None | |
562 |
|
562 | |||
563 |
|
563 | |||
564 | def getNoisebyHildebrand(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
564 | def getNoisebyHildebrand(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): | |
565 | """ |
|
565 | """ | |
566 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon |
|
566 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon | |
567 |
|
567 | |||
568 | Return: |
|
568 | Return: | |
569 | noiselevel |
|
569 | noiselevel | |
570 | """ |
|
570 | """ | |
571 |
|
571 | |||
572 | noise = numpy.zeros(self.nChannels) |
|
572 | noise = numpy.zeros(self.nChannels) | |
573 |
|
573 | |||
574 | for channel in range(self.nChannels): |
|
574 | for channel in range(self.nChannels): | |
575 | daux = self.data_spc[channel,xmin_index:xmax_index,ymin_index:ymax_index] |
|
575 | daux = self.data_spc[channel,xmin_index:xmax_index,ymin_index:ymax_index] | |
576 | noise[channel] = hildebrand_sekhon(daux, self.nIncohInt) |
|
576 | noise[channel] = hildebrand_sekhon(daux, self.nIncohInt) | |
577 |
|
577 | |||
578 | return noise |
|
578 | return noise | |
579 |
|
579 | |||
580 | def getNoise(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
580 | def getNoise(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): | |
581 |
|
581 | |||
582 | if self.noise_estimation != None: |
|
582 | if self.noise_estimation != None: | |
583 | return self.noise_estimation #this was estimated by getNoise Operation defined in jroproc_spectra.py |
|
583 | return self.noise_estimation #this was estimated by getNoise Operation defined in jroproc_spectra.py | |
584 | else: |
|
584 | else: | |
585 | noise = self.getNoisebyHildebrand(xmin_index, xmax_index, ymin_index, ymax_index) |
|
585 | noise = self.getNoisebyHildebrand(xmin_index, xmax_index, ymin_index, ymax_index) | |
586 | return noise |
|
586 | return noise | |
587 |
|
587 | |||
588 |
|
588 | |||
589 | def getFreqRange(self, extrapoints=0): |
|
589 | def getFreqRange(self, extrapoints=0): | |
590 |
|
590 | |||
591 | deltafreq = self.getFmax() / (self.nFFTPoints*self.ippFactor) |
|
591 | deltafreq = self.getFmax() / (self.nFFTPoints*self.ippFactor) | |
592 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 |
|
592 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 | |
593 |
|
593 | |||
594 | return freqrange |
|
594 | return freqrange | |
595 |
|
595 | |||
596 | def getVelRange(self, extrapoints=0): |
|
596 | def getVelRange(self, extrapoints=0): | |
597 |
|
597 | |||
598 | deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor) |
|
598 | deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor) | |
599 | velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltav/2 |
|
599 | velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltav/2 | |
600 |
|
600 | |||
601 | return velrange |
|
601 | return velrange | |
602 |
|
602 | |||
603 | def getNPairs(self): |
|
603 | def getNPairs(self): | |
604 |
|
604 | |||
605 | return len(self.pairsList) |
|
605 | return len(self.pairsList) | |
606 |
|
606 | |||
607 | def getPairsIndexList(self): |
|
607 | def getPairsIndexList(self): | |
608 |
|
608 | |||
609 | return range(self.nPairs) |
|
609 | return range(self.nPairs) | |
610 |
|
610 | |||
611 | def getNormFactor(self): |
|
611 | def getNormFactor(self): | |
612 |
|
612 | |||
613 | pwcode = 1 |
|
613 | pwcode = 1 | |
614 |
|
614 | |||
615 | if self.flagDecodeData: |
|
615 | if self.flagDecodeData: | |
616 | pwcode = numpy.sum(self.code[0]**2) |
|
616 | pwcode = numpy.sum(self.code[0]**2) | |
617 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter |
|
617 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter | |
618 | normFactor = self.nProfiles*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter |
|
618 | normFactor = self.nProfiles*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter | |
619 |
|
619 | |||
620 | return normFactor |
|
620 | return normFactor | |
621 |
|
621 | |||
622 | def getFlagCspc(self): |
|
622 | def getFlagCspc(self): | |
623 |
|
623 | |||
624 | if self.data_cspc is None: |
|
624 | if self.data_cspc is None: | |
625 | return True |
|
625 | return True | |
626 |
|
626 | |||
627 | return False |
|
627 | return False | |
628 |
|
628 | |||
629 | def getFlagDc(self): |
|
629 | def getFlagDc(self): | |
630 |
|
630 | |||
631 | if self.data_dc is None: |
|
631 | if self.data_dc is None: | |
632 | return True |
|
632 | return True | |
633 |
|
633 | |||
634 | return False |
|
634 | return False | |
635 |
|
635 | |||
636 | def getTimeInterval(self): |
|
636 | def getTimeInterval(self): | |
637 |
|
637 | |||
638 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt * self.nProfiles |
|
638 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt * self.nProfiles | |
639 |
|
639 | |||
640 | return timeInterval |
|
640 | return timeInterval | |
641 |
|
641 | |||
642 | def setValue(self, value): |
|
642 | def setValue(self, value): | |
643 |
|
643 | |||
644 | print "This property should not be initialized" |
|
644 | print "This property should not be initialized" | |
645 |
|
645 | |||
646 | return |
|
646 | return | |
647 |
|
647 | |||
648 | nPairs = property(getNPairs, setValue, "I'm the 'nPairs' property.") |
|
648 | nPairs = property(getNPairs, setValue, "I'm the 'nPairs' property.") | |
649 | pairsIndexList = property(getPairsIndexList, setValue, "I'm the 'pairsIndexList' property.") |
|
649 | pairsIndexList = property(getPairsIndexList, setValue, "I'm the 'pairsIndexList' property.") | |
650 | normFactor = property(getNormFactor, setValue, "I'm the 'getNormFactor' property.") |
|
650 | normFactor = property(getNormFactor, setValue, "I'm the 'getNormFactor' property.") | |
651 | flag_cspc = property(getFlagCspc, setValue) |
|
651 | flag_cspc = property(getFlagCspc, setValue) | |
652 | flag_dc = property(getFlagDc, setValue) |
|
652 | flag_dc = property(getFlagDc, setValue) | |
653 | noise = property(getNoise, setValue, "I'm the 'nHeights' property.") |
|
653 | noise = property(getNoise, setValue, "I'm the 'nHeights' property.") | |
654 | timeInterval = property(getTimeInterval, setValue, "I'm the 'timeInterval' property") |
|
654 | timeInterval = property(getTimeInterval, setValue, "I'm the 'timeInterval' property") | |
655 |
|
655 | |||
656 | class SpectraHeis(Spectra): |
|
656 | class SpectraHeis(Spectra): | |
657 |
|
657 | |||
658 | data_spc = None |
|
658 | data_spc = None | |
659 |
|
659 | |||
660 | data_cspc = None |
|
660 | data_cspc = None | |
661 |
|
661 | |||
662 | data_dc = None |
|
662 | data_dc = None | |
663 |
|
663 | |||
664 | nFFTPoints = None |
|
664 | nFFTPoints = None | |
665 |
|
665 | |||
666 | # nPairs = None |
|
666 | # nPairs = None | |
667 |
|
667 | |||
668 | pairsList = None |
|
668 | pairsList = None | |
669 |
|
669 | |||
670 | nCohInt = None |
|
670 | nCohInt = None | |
671 |
|
671 | |||
672 | nIncohInt = None |
|
672 | nIncohInt = None | |
673 |
|
673 | |||
674 | def __init__(self): |
|
674 | def __init__(self): | |
675 |
|
675 | |||
676 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
676 | self.radarControllerHeaderObj = RadarControllerHeader() | |
677 |
|
677 | |||
678 | self.systemHeaderObj = SystemHeader() |
|
678 | self.systemHeaderObj = SystemHeader() | |
679 |
|
679 | |||
680 | self.type = "SpectraHeis" |
|
680 | self.type = "SpectraHeis" | |
681 |
|
681 | |||
682 | # self.dtype = None |
|
682 | # self.dtype = None | |
683 |
|
683 | |||
684 | # self.nChannels = 0 |
|
684 | # self.nChannels = 0 | |
685 |
|
685 | |||
686 | # self.nHeights = 0 |
|
686 | # self.nHeights = 0 | |
687 |
|
687 | |||
688 | self.nProfiles = None |
|
688 | self.nProfiles = None | |
689 |
|
689 | |||
690 | self.heightList = None |
|
690 | self.heightList = None | |
691 |
|
691 | |||
692 | self.channelList = None |
|
692 | self.channelList = None | |
693 |
|
693 | |||
694 | # self.channelIndexList = None |
|
694 | # self.channelIndexList = None | |
695 |
|
695 | |||
696 | self.flagNoData = True |
|
696 | self.flagNoData = True | |
697 |
|
697 | |||
698 | self.flagDiscontinuousBlock = False |
|
698 | self.flagDiscontinuousBlock = False | |
699 |
|
699 | |||
700 | # self.nPairs = 0 |
|
700 | # self.nPairs = 0 | |
701 |
|
701 | |||
702 | self.utctime = None |
|
702 | self.utctime = None | |
703 |
|
703 | |||
704 | self.blocksize = None |
|
704 | self.blocksize = None | |
705 |
|
705 | |||
706 | self.profileIndex = 0 |
|
706 | self.profileIndex = 0 | |
707 |
|
707 | |||
708 | self.nCohInt = 1 |
|
708 | self.nCohInt = 1 | |
709 |
|
709 | |||
710 | self.nIncohInt = 1 |
|
710 | self.nIncohInt = 1 | |
711 |
|
711 | |||
712 | def getNormFactor(self): |
|
712 | def getNormFactor(self): | |
713 | pwcode = 1 |
|
713 | pwcode = 1 | |
714 | if self.flagDecodeData: |
|
714 | if self.flagDecodeData: | |
715 | pwcode = numpy.sum(self.code[0]**2) |
|
715 | pwcode = numpy.sum(self.code[0]**2) | |
716 |
|
716 | |||
717 | normFactor = self.nIncohInt*self.nCohInt*pwcode |
|
717 | normFactor = self.nIncohInt*self.nCohInt*pwcode | |
718 |
|
718 | |||
719 | return normFactor |
|
719 | return normFactor | |
720 |
|
720 | |||
721 | def getTimeInterval(self): |
|
721 | def getTimeInterval(self): | |
722 |
|
722 | |||
723 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
723 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt | |
724 |
|
724 | |||
725 | return timeInterval |
|
725 | return timeInterval | |
726 |
|
726 | |||
727 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") |
|
727 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") | |
728 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
728 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
729 |
|
729 | |||
730 | class Fits(JROData): |
|
730 | class Fits(JROData): | |
731 |
|
731 | |||
732 | heightList = None |
|
732 | heightList = None | |
733 |
|
733 | |||
734 | channelList = None |
|
734 | channelList = None | |
735 |
|
735 | |||
736 | flagNoData = True |
|
736 | flagNoData = True | |
737 |
|
737 | |||
738 | flagDiscontinuousBlock = False |
|
738 | flagDiscontinuousBlock = False | |
739 |
|
739 | |||
740 | useLocalTime = False |
|
740 | useLocalTime = False | |
741 |
|
741 | |||
742 | utctime = None |
|
742 | utctime = None | |
743 |
|
743 | |||
744 | timeZone = None |
|
744 | timeZone = None | |
745 |
|
745 | |||
746 | # ippSeconds = None |
|
746 | # ippSeconds = None | |
747 |
|
747 | |||
748 | # timeInterval = None |
|
748 | # timeInterval = None | |
749 |
|
749 | |||
750 | nCohInt = None |
|
750 | nCohInt = None | |
751 |
|
751 | |||
752 | nIncohInt = None |
|
752 | nIncohInt = None | |
753 |
|
753 | |||
754 | noise = None |
|
754 | noise = None | |
755 |
|
755 | |||
756 | windowOfFilter = 1 |
|
756 | windowOfFilter = 1 | |
757 |
|
757 | |||
758 | #Speed of ligth |
|
758 | #Speed of ligth | |
759 | C = 3e8 |
|
759 | C = 3e8 | |
760 |
|
760 | |||
761 | frequency = 49.92e6 |
|
761 | frequency = 49.92e6 | |
762 |
|
762 | |||
763 | realtime = False |
|
763 | realtime = False | |
764 |
|
764 | |||
765 |
|
765 | |||
766 | def __init__(self): |
|
766 | def __init__(self): | |
767 |
|
767 | |||
768 | self.type = "Fits" |
|
768 | self.type = "Fits" | |
769 |
|
769 | |||
770 | self.nProfiles = None |
|
770 | self.nProfiles = None | |
771 |
|
771 | |||
772 | self.heightList = None |
|
772 | self.heightList = None | |
773 |
|
773 | |||
774 | self.channelList = None |
|
774 | self.channelList = None | |
775 |
|
775 | |||
776 | # self.channelIndexList = None |
|
776 | # self.channelIndexList = None | |
777 |
|
777 | |||
778 | self.flagNoData = True |
|
778 | self.flagNoData = True | |
779 |
|
779 | |||
780 | self.utctime = None |
|
780 | self.utctime = None | |
781 |
|
781 | |||
782 | self.nCohInt = 1 |
|
782 | self.nCohInt = 1 | |
783 |
|
783 | |||
784 | self.nIncohInt = 1 |
|
784 | self.nIncohInt = 1 | |
785 |
|
785 | |||
786 | self.useLocalTime = True |
|
786 | self.useLocalTime = True | |
787 |
|
787 | |||
788 | self.profileIndex = 0 |
|
788 | self.profileIndex = 0 | |
789 |
|
789 | |||
790 | # self.utctime = None |
|
790 | # self.utctime = None | |
791 | # self.timeZone = None |
|
791 | # self.timeZone = None | |
792 | # self.ltctime = None |
|
792 | # self.ltctime = None | |
793 | # self.timeInterval = None |
|
793 | # self.timeInterval = None | |
794 | # self.header = None |
|
794 | # self.header = None | |
795 | # self.data_header = None |
|
795 | # self.data_header = None | |
796 | # self.data = None |
|
796 | # self.data = None | |
797 | # self.datatime = None |
|
797 | # self.datatime = None | |
798 | # self.flagNoData = False |
|
798 | # self.flagNoData = False | |
799 | # self.expName = '' |
|
799 | # self.expName = '' | |
800 | # self.nChannels = None |
|
800 | # self.nChannels = None | |
801 | # self.nSamples = None |
|
801 | # self.nSamples = None | |
802 | # self.dataBlocksPerFile = None |
|
802 | # self.dataBlocksPerFile = None | |
803 | # self.comments = '' |
|
803 | # self.comments = '' | |
804 | # |
|
804 | # | |
805 |
|
805 | |||
806 |
|
806 | |||
807 | def getltctime(self): |
|
807 | def getltctime(self): | |
808 |
|
808 | |||
809 | if self.useLocalTime: |
|
809 | if self.useLocalTime: | |
810 | return self.utctime - self.timeZone*60 |
|
810 | return self.utctime - self.timeZone*60 | |
811 |
|
811 | |||
812 | return self.utctime |
|
812 | return self.utctime | |
813 |
|
813 | |||
814 | def getDatatime(self): |
|
814 | def getDatatime(self): | |
815 |
|
815 | |||
816 | datatime = datetime.datetime.utcfromtimestamp(self.ltctime) |
|
816 | datatime = datetime.datetime.utcfromtimestamp(self.ltctime) | |
817 | return datatime |
|
817 | return datatime | |
818 |
|
818 | |||
819 | def getTimeRange(self): |
|
819 | def getTimeRange(self): | |
820 |
|
820 | |||
821 | datatime = [] |
|
821 | datatime = [] | |
822 |
|
822 | |||
823 | datatime.append(self.ltctime) |
|
823 | datatime.append(self.ltctime) | |
824 | datatime.append(self.ltctime + self.timeInterval) |
|
824 | datatime.append(self.ltctime + self.timeInterval) | |
825 |
|
825 | |||
826 | datatime = numpy.array(datatime) |
|
826 | datatime = numpy.array(datatime) | |
827 |
|
827 | |||
828 | return datatime |
|
828 | return datatime | |
829 |
|
829 | |||
830 | def getHeiRange(self): |
|
830 | def getHeiRange(self): | |
831 |
|
831 | |||
832 | heis = self.heightList |
|
832 | heis = self.heightList | |
833 |
|
833 | |||
834 | return heis |
|
834 | return heis | |
835 |
|
835 | |||
836 | def isEmpty(self): |
|
836 | def isEmpty(self): | |
837 |
|
837 | |||
838 | return self.flagNoData |
|
838 | return self.flagNoData | |
839 |
|
839 | |||
840 | def getNHeights(self): |
|
840 | def getNHeights(self): | |
841 |
|
841 | |||
842 | return len(self.heightList) |
|
842 | return len(self.heightList) | |
843 |
|
843 | |||
844 | def getNChannels(self): |
|
844 | def getNChannels(self): | |
845 |
|
845 | |||
846 | return len(self.channelList) |
|
846 | return len(self.channelList) | |
847 |
|
847 | |||
848 | def getChannelIndexList(self): |
|
848 | def getChannelIndexList(self): | |
849 |
|
849 | |||
850 | return range(self.nChannels) |
|
850 | return range(self.nChannels) | |
851 |
|
851 | |||
852 | def getNoise(self, type = 1): |
|
852 | def getNoise(self, type = 1): | |
853 |
|
853 | |||
854 | #noise = numpy.zeros(self.nChannels) |
|
854 | #noise = numpy.zeros(self.nChannels) | |
855 |
|
855 | |||
856 | if type == 1: |
|
856 | if type == 1: | |
857 | noise = self.getNoisebyHildebrand() |
|
857 | noise = self.getNoisebyHildebrand() | |
858 |
|
858 | |||
859 | if type == 2: |
|
859 | if type == 2: | |
860 | noise = self.getNoisebySort() |
|
860 | noise = self.getNoisebySort() | |
861 |
|
861 | |||
862 | if type == 3: |
|
862 | if type == 3: | |
863 | noise = self.getNoisebyWindow() |
|
863 | noise = self.getNoisebyWindow() | |
864 |
|
864 | |||
865 | return noise |
|
865 | return noise | |
866 |
|
866 | |||
867 | def getTimeInterval(self): |
|
867 | def getTimeInterval(self): | |
868 |
|
868 | |||
869 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
869 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt | |
870 |
|
870 | |||
871 | return timeInterval |
|
871 | return timeInterval | |
872 |
|
872 | |||
873 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
873 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
874 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
874 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
875 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
875 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") | |
876 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
876 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") | |
877 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
877 | noise = property(getNoise, "I'm the 'nHeights' property.") | |
878 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
878 | ||
879 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
879 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
880 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
880 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
881 |
|
881 | |||
882 | class Correlation(JROData): |
|
882 | class Correlation(JROData): | |
883 |
|
883 | |||
884 | noise = None |
|
884 | noise = None | |
885 |
|
885 | |||
886 | SNR = None |
|
886 | SNR = None | |
887 |
|
887 | |||
888 | pairsAutoCorr = None #Pairs of Autocorrelation |
|
888 | pairsAutoCorr = None #Pairs of Autocorrelation | |
889 |
|
889 | |||
890 | #-------------------------------------------------- |
|
890 | #-------------------------------------------------- | |
891 |
|
891 | |||
892 | data_corr = None |
|
892 | data_corr = None | |
893 |
|
893 | |||
894 | data_volt = None |
|
894 | data_volt = None | |
895 |
|
895 | |||
896 | lagT = None # each element value is a profileIndex |
|
896 | lagT = None # each element value is a profileIndex | |
897 |
|
897 | |||
898 | lagR = None # each element value is in km |
|
898 | lagR = None # each element value is in km | |
899 |
|
899 | |||
900 | pairsList = None |
|
900 | pairsList = None | |
901 |
|
901 | |||
902 | calculateVelocity = None |
|
902 | calculateVelocity = None | |
903 |
|
903 | |||
904 | nPoints = None |
|
904 | nPoints = None | |
905 |
|
905 | |||
906 | nAvg = None |
|
906 | nAvg = None | |
907 |
|
907 | |||
908 | bufferSize = None |
|
908 | bufferSize = None | |
909 |
|
909 | |||
910 | def __init__(self): |
|
910 | def __init__(self): | |
911 | ''' |
|
911 | ''' | |
912 | Constructor |
|
912 | Constructor | |
913 | ''' |
|
913 | ''' | |
914 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
914 | self.radarControllerHeaderObj = RadarControllerHeader() | |
915 |
|
915 | |||
916 | self.systemHeaderObj = SystemHeader() |
|
916 | self.systemHeaderObj = SystemHeader() | |
917 |
|
917 | |||
918 | self.type = "Correlation" |
|
918 | self.type = "Correlation" | |
919 |
|
919 | |||
920 | self.data = None |
|
920 | self.data = None | |
921 |
|
921 | |||
922 | self.dtype = None |
|
922 | self.dtype = None | |
923 |
|
923 | |||
924 | self.nProfiles = None |
|
924 | self.nProfiles = None | |
925 |
|
925 | |||
926 | self.heightList = None |
|
926 | self.heightList = None | |
927 |
|
927 | |||
928 | self.channelList = None |
|
928 | self.channelList = None | |
929 |
|
929 | |||
930 | self.flagNoData = True |
|
930 | self.flagNoData = True | |
931 |
|
931 | |||
932 | self.flagDiscontinuousBlock = False |
|
932 | self.flagDiscontinuousBlock = False | |
933 |
|
933 | |||
934 | self.utctime = None |
|
934 | self.utctime = None | |
935 |
|
935 | |||
936 | self.timeZone = None |
|
936 | self.timeZone = None | |
937 |
|
937 | |||
938 | self.dstFlag = None |
|
938 | self.dstFlag = None | |
939 |
|
939 | |||
940 | self.errorCount = None |
|
940 | self.errorCount = None | |
941 |
|
941 | |||
942 | self.blocksize = None |
|
942 | self.blocksize = None | |
943 |
|
943 | |||
944 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
944 | self.flagDecodeData = False #asumo q la data no esta decodificada | |
945 |
|
945 | |||
946 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
946 | self.flagDeflipData = False #asumo q la data no esta sin flip | |
947 |
|
947 | |||
948 | self.pairsList = None |
|
948 | self.pairsList = None | |
949 |
|
949 | |||
950 | self.nPoints = None |
|
950 | self.nPoints = None | |
951 |
|
951 | |||
952 | def getLagTRange(self, extrapoints=0): |
|
952 | def getLagTRange(self, extrapoints=0): | |
953 |
|
953 | |||
954 | lagTRange = self.lagT |
|
954 | lagTRange = self.lagT | |
955 | diff = lagTRange[1] - lagTRange[0] |
|
955 | diff = lagTRange[1] - lagTRange[0] | |
956 | extra = numpy.arange(1,extrapoints + 1)*diff + lagTRange[-1] |
|
956 | extra = numpy.arange(1,extrapoints + 1)*diff + lagTRange[-1] | |
957 | lagTRange = numpy.hstack((lagTRange, extra)) |
|
957 | lagTRange = numpy.hstack((lagTRange, extra)) | |
958 |
|
958 | |||
959 | return lagTRange |
|
959 | return lagTRange | |
960 |
|
960 | |||
961 | def getLagRRange(self, extrapoints=0): |
|
961 | def getLagRRange(self, extrapoints=0): | |
962 |
|
962 | |||
963 | return self.lagR |
|
963 | return self.lagR | |
964 |
|
964 | |||
965 | def getPairsList(self): |
|
965 | def getPairsList(self): | |
966 |
|
966 | |||
967 | return self.pairsList |
|
967 | return self.pairsList | |
968 |
|
968 | |||
969 | def getCalculateVelocity(self): |
|
969 | def getCalculateVelocity(self): | |
970 |
|
970 | |||
971 | return self.calculateVelocity |
|
971 | return self.calculateVelocity | |
972 |
|
972 | |||
973 | def getNPoints(self): |
|
973 | def getNPoints(self): | |
974 |
|
974 | |||
975 | return self.nPoints |
|
975 | return self.nPoints | |
976 |
|
976 | |||
977 | def getNAvg(self): |
|
977 | def getNAvg(self): | |
978 |
|
978 | |||
979 | return self.nAvg |
|
979 | return self.nAvg | |
980 |
|
980 | |||
981 | def getBufferSize(self): |
|
981 | def getBufferSize(self): | |
982 |
|
982 | |||
983 | return self.bufferSize |
|
983 | return self.bufferSize | |
984 |
|
984 | |||
985 | def getPairsAutoCorr(self): |
|
985 | def getPairsAutoCorr(self): | |
986 | pairsList = self.pairsList |
|
986 | pairsList = self.pairsList | |
987 | pairsAutoCorr = numpy.zeros(self.nChannels, dtype = 'int')*numpy.nan |
|
987 | pairsAutoCorr = numpy.zeros(self.nChannels, dtype = 'int')*numpy.nan | |
988 |
|
988 | |||
989 | for l in range(len(pairsList)): |
|
989 | for l in range(len(pairsList)): | |
990 | firstChannel = pairsList[l][0] |
|
990 | firstChannel = pairsList[l][0] | |
991 | secondChannel = pairsList[l][1] |
|
991 | secondChannel = pairsList[l][1] | |
992 |
|
992 | |||
993 | #Obteniendo pares de Autocorrelacion |
|
993 | #Obteniendo pares de Autocorrelacion | |
994 | if firstChannel == secondChannel: |
|
994 | if firstChannel == secondChannel: | |
995 | pairsAutoCorr[firstChannel] = int(l) |
|
995 | pairsAutoCorr[firstChannel] = int(l) | |
996 |
|
996 | |||
997 | pairsAutoCorr = pairsAutoCorr.astype(int) |
|
997 | pairsAutoCorr = pairsAutoCorr.astype(int) | |
998 |
|
998 | |||
999 | return pairsAutoCorr |
|
999 | return pairsAutoCorr | |
1000 |
|
1000 | |||
1001 | def getNoise(self, mode = 2): |
|
1001 | def getNoise(self, mode = 2): | |
1002 |
|
1002 | |||
1003 | indR = numpy.where(self.lagR == 0)[0][0] |
|
1003 | indR = numpy.where(self.lagR == 0)[0][0] | |
1004 | indT = numpy.where(self.lagT == 0)[0][0] |
|
1004 | indT = numpy.where(self.lagT == 0)[0][0] | |
1005 |
|
1005 | |||
1006 | jspectra0 = self.data_corr[:,:,indR,:] |
|
1006 | jspectra0 = self.data_corr[:,:,indR,:] | |
1007 | jspectra = copy.copy(jspectra0) |
|
1007 | jspectra = copy.copy(jspectra0) | |
1008 |
|
1008 | |||
1009 | num_chan = jspectra.shape[0] |
|
1009 | num_chan = jspectra.shape[0] | |
1010 | num_hei = jspectra.shape[2] |
|
1010 | num_hei = jspectra.shape[2] | |
1011 |
|
1011 | |||
1012 | freq_dc = jspectra.shape[1]/2 |
|
1012 | freq_dc = jspectra.shape[1]/2 | |
1013 | ind_vel = numpy.array([-2,-1,1,2]) + freq_dc |
|
1013 | ind_vel = numpy.array([-2,-1,1,2]) + freq_dc | |
1014 |
|
1014 | |||
1015 | if ind_vel[0]<0: |
|
1015 | if ind_vel[0]<0: | |
1016 | ind_vel[range(0,1)] = ind_vel[range(0,1)] + self.num_prof |
|
1016 | ind_vel[range(0,1)] = ind_vel[range(0,1)] + self.num_prof | |
1017 |
|
1017 | |||
1018 | if mode == 1: |
|
1018 | if mode == 1: | |
1019 | jspectra[:,freq_dc,:] = (jspectra[:,ind_vel[1],:] + jspectra[:,ind_vel[2],:])/2 #CORRECCION |
|
1019 | jspectra[:,freq_dc,:] = (jspectra[:,ind_vel[1],:] + jspectra[:,ind_vel[2],:])/2 #CORRECCION | |
1020 |
|
1020 | |||
1021 | if mode == 2: |
|
1021 | if mode == 2: | |
1022 |
|
1022 | |||
1023 | vel = numpy.array([-2,-1,1,2]) |
|
1023 | vel = numpy.array([-2,-1,1,2]) | |
1024 | xx = numpy.zeros([4,4]) |
|
1024 | xx = numpy.zeros([4,4]) | |
1025 |
|
1025 | |||
1026 | for fil in range(4): |
|
1026 | for fil in range(4): | |
1027 | xx[fil,:] = vel[fil]**numpy.asarray(range(4)) |
|
1027 | xx[fil,:] = vel[fil]**numpy.asarray(range(4)) | |
1028 |
|
1028 | |||
1029 | xx_inv = numpy.linalg.inv(xx) |
|
1029 | xx_inv = numpy.linalg.inv(xx) | |
1030 | xx_aux = xx_inv[0,:] |
|
1030 | xx_aux = xx_inv[0,:] | |
1031 |
|
1031 | |||
1032 | for ich in range(num_chan): |
|
1032 | for ich in range(num_chan): | |
1033 | yy = jspectra[ich,ind_vel,:] |
|
1033 | yy = jspectra[ich,ind_vel,:] | |
1034 | jspectra[ich,freq_dc,:] = numpy.dot(xx_aux,yy) |
|
1034 | jspectra[ich,freq_dc,:] = numpy.dot(xx_aux,yy) | |
1035 |
|
1035 | |||
1036 | junkid = jspectra[ich,freq_dc,:]<=0 |
|
1036 | junkid = jspectra[ich,freq_dc,:]<=0 | |
1037 | cjunkid = sum(junkid) |
|
1037 | cjunkid = sum(junkid) | |
1038 |
|
1038 | |||
1039 | if cjunkid.any(): |
|
1039 | if cjunkid.any(): | |
1040 | jspectra[ich,freq_dc,junkid.nonzero()] = (jspectra[ich,ind_vel[1],junkid] + jspectra[ich,ind_vel[2],junkid])/2 |
|
1040 | jspectra[ich,freq_dc,junkid.nonzero()] = (jspectra[ich,ind_vel[1],junkid] + jspectra[ich,ind_vel[2],junkid])/2 | |
1041 |
|
1041 | |||
1042 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] |
|
1042 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] | |
1043 |
|
1043 | |||
1044 | return noise |
|
1044 | return noise | |
1045 |
|
1045 | |||
1046 | def getTimeInterval(self): |
|
1046 | def getTimeInterval(self): | |
1047 |
|
1047 | |||
1048 | timeInterval = self.ippSeconds * self.nCohInt * self.nPoints |
|
1048 | timeInterval = self.ippSeconds * self.nCohInt * self.nPoints | |
1049 |
|
1049 | |||
1050 | return timeInterval |
|
1050 | return timeInterval | |
1051 |
|
1051 | |||
1052 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
1052 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
1053 | # pairsList = property(getPairsList, "I'm the 'pairsList' property.") |
|
1053 | # pairsList = property(getPairsList, "I'm the 'pairsList' property.") | |
1054 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") |
|
1054 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") | |
1055 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") |
|
1055 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") | |
1056 | nAvg = property(getNAvg, "I'm the 'nAvg' property.") |
|
1056 | nAvg = property(getNAvg, "I'm the 'nAvg' property.") | |
1057 | bufferSize = property(getBufferSize, "I'm the 'bufferSize' property.") |
|
1057 | bufferSize = property(getBufferSize, "I'm the 'bufferSize' property.") | |
1058 |
|
1058 | |||
1059 |
|
1059 | |||
1060 | class Parameters(JROData): |
|
1060 | class Parameters(JROData): | |
1061 |
|
1061 | |||
1062 | #Information from previous data |
|
1062 | #Information from previous data | |
1063 |
|
1063 | |||
1064 | inputUnit = None #Type of data to be processed |
|
1064 | inputUnit = None #Type of data to be processed | |
1065 |
|
1065 | |||
1066 | operation = None #Type of operation to parametrize |
|
1066 | operation = None #Type of operation to parametrize | |
1067 |
|
1067 | |||
1068 | normFactor = None #Normalization Factor |
|
1068 | normFactor = None #Normalization Factor | |
1069 |
|
1069 | |||
1070 | groupList = None #List of Pairs, Groups, etc |
|
1070 | groupList = None #List of Pairs, Groups, etc | |
1071 |
|
1071 | |||
1072 | #Parameters |
|
1072 | #Parameters | |
1073 |
|
1073 | |||
1074 | data_param = None #Parameters obtained |
|
1074 | data_param = None #Parameters obtained | |
1075 |
|
1075 | |||
1076 | data_pre = None #Data Pre Parametrization |
|
1076 | data_pre = None #Data Pre Parametrization | |
1077 |
|
1077 | |||
1078 | data_SNR = None #Signal to Noise Ratio |
|
1078 | data_SNR = None #Signal to Noise Ratio | |
1079 |
|
1079 | |||
1080 | # heightRange = None #Heights |
|
1080 | # heightRange = None #Heights | |
1081 |
|
1081 | |||
1082 | abscissaList = None #Abscissa, can be velocities, lags or time |
|
1082 | abscissaList = None #Abscissa, can be velocities, lags or time | |
1083 |
|
1083 | |||
1084 | noise = None #Noise Potency |
|
1084 | noise = None #Noise Potency | |
1085 |
|
1085 | |||
1086 | utctimeInit = None #Initial UTC time |
|
1086 | utctimeInit = None #Initial UTC time | |
1087 |
|
1087 | |||
1088 | paramInterval = None #Time interval to calculate Parameters in seconds |
|
1088 | paramInterval = None #Time interval to calculate Parameters in seconds | |
1089 |
|
1089 | |||
1090 | #Fitting |
|
1090 | #Fitting | |
1091 |
|
1091 | |||
1092 | data_error = None #Error of the estimation |
|
1092 | data_error = None #Error of the estimation | |
1093 |
|
1093 | |||
1094 | constants = None |
|
1094 | constants = None | |
1095 |
|
1095 | |||
1096 | library = None |
|
1096 | library = None | |
1097 |
|
1097 | |||
1098 | #Output signal |
|
1098 | #Output signal | |
1099 |
|
1099 | |||
1100 | outputInterval = None #Time interval to calculate output signal in seconds |
|
1100 | outputInterval = None #Time interval to calculate output signal in seconds | |
1101 |
|
1101 | |||
1102 | data_output = None #Out signal |
|
1102 | data_output = None #Out signal | |
1103 |
|
1103 | |||
1104 |
|
1104 | |||
1105 |
|
1105 | |||
1106 | def __init__(self): |
|
1106 | def __init__(self): | |
1107 | ''' |
|
1107 | ''' | |
1108 | Constructor |
|
1108 | Constructor | |
1109 | ''' |
|
1109 | ''' | |
1110 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
1110 | self.radarControllerHeaderObj = RadarControllerHeader() | |
1111 |
|
1111 | |||
1112 | self.systemHeaderObj = SystemHeader() |
|
1112 | self.systemHeaderObj = SystemHeader() | |
1113 |
|
1113 | |||
1114 | self.type = "Parameters" |
|
1114 | self.type = "Parameters" | |
1115 |
|
1115 | |||
1116 | def getTimeRange1(self): |
|
1116 | def getTimeRange1(self): | |
1117 |
|
1117 | |||
1118 | datatime = [] |
|
1118 | datatime = [] | |
1119 |
|
1119 | |||
1120 | if self.useLocalTime: |
|
1120 | if self.useLocalTime: | |
1121 | time1 = self.utctimeInit - self.timeZone*60 |
|
1121 | time1 = self.utctimeInit - self.timeZone*60 | |
1122 | else: |
|
1122 | else: | |
1123 | time1 = utctimeInit |
|
1123 | time1 = utctimeInit | |
1124 |
|
1124 | |||
1125 | # datatime.append(self.utctimeInit) |
|
1125 | # datatime.append(self.utctimeInit) | |
1126 | # datatime.append(self.utctimeInit + self.outputInterval) |
|
1126 | # datatime.append(self.utctimeInit + self.outputInterval) | |
1127 | datatime.append(time1) |
|
1127 | datatime.append(time1) | |
1128 | datatime.append(time1 + self.outputInterval) |
|
1128 | datatime.append(time1 + self.outputInterval) | |
1129 |
|
1129 | |||
1130 | datatime = numpy.array(datatime) |
|
1130 | datatime = numpy.array(datatime) | |
1131 |
|
1131 | |||
1132 | return datatime |
|
1132 | return datatime |
General Comments 0
You need to be logged in to leave comments.
Login now