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