##// END OF EJS Templates
VoltageProcessor.py:...
Victor Sarmiento -
r97:4bafecca4fcc
parent child
Show More
@@ -158,42 +158,42 class VoltageProcessor:
158 Selecciona un bloque de datos en base a canales y pares segun el channelList y el pairList
158 Selecciona un bloque de datos en base a canales y pares segun el channelList y el pairList
159
159
160 Input:
160 Input:
161 channelList : lista sencilla de canales a seleccionar por ej. (2,3,7)
161 channelList : lista sencilla de canales a seleccionar por ej. [2,3,7]
162 pairList : tupla de pares que se desea selecionar por ej. ( (0,1), (0,2) )
163
162
164 Affected:
163 Affected:
165 self.dataOutObj.datablock
164 self.dataOutObj.data
165 self.voltageOutObj.channelList
166 self.dataOutObj.nChannels
166 self.dataOutObj.nChannels
167 self.voltageOutObj.m_ProcessingHeader.totalSpectra
167 self.dataOutObj.m_SystemHeader.numChannels
168 self.dataOutObj.m_SystemHeader.numChannels
168 self.voltageOutObj.m_ProcessingHeader.blockSize
169 self.voltageOutObj.m_ProcessingHeader.blockSize
169
170
170 Return:
171 Return:
171 None
172 None
172 """
173 """
173 if not(channelList):
174 if self.voltageOutObj.flagNoData:
174 return
175 return 0
176
177 for channel in channelList:
178 if channel not in self.voltageOutObj.channelList:
179 raise ValueError, "The value %d in channelList is not valid" %channel
175
180
176 channels = 0
181 nchannels = len(channelList)
177 profiles = self.voltageOutObj.nProfiles
182 profiles = self.voltageOutObj.nProfiles
178 heights = self.voltageOutObj.m_ProcessingHeader.numHeights
183 heights = self.voltageOutObj.nHeights #m_ProcessingHeader.numHeights
179
184
180 #self spectra
185 data = numpy.zeros( (nchannels,heights), dtype='complex' )
181 channels = len(channelList)
182 data = numpy.zeros( (channels,profiles,heights), dtype='complex' )
183 for index,channel in enumerate(channelList):
186 for index,channel in enumerate(channelList):
184 data[index,:,:] = self.voltageOutObj.data_spc[channel,:,:]
187 data[index,:] = self.voltageOutObj.data[channel,:]
185
188
186 self.voltageOutObj.datablock = data
189 self.voltageOutObj.data = data
187
188 #fill the m_ProcessingHeader.spectraComb up
189 channels = len(channelList)
190
191 self.voltageOutObj.channelList = channelList
190 self.voltageOutObj.channelList = channelList
192 self.voltageOutObj.nChannels = nchannels
191 self.voltageOutObj.nChannels = nchannels
193 self.voltageOutObj.m_ProcessingHeader.totalSpectra = nchannels
192 self.voltageOutObj.m_ProcessingHeader.totalSpectra = nchannels
194 self.voltageOutObj.m_SystemHeader.numChannels = nchannels
193 self.voltageOutObj.m_SystemHeader.numChannels = nchannels
195 self.voltageOutObj.m_ProcessingHeader.blockSize = data.size
194 self.voltageOutObj.m_ProcessingHeader.blockSize = data.size
196
195 return 1
196
197
197
198 def selectHeightsByValue(self, minHei, maxHei):
198 def selectHeightsByValue(self, minHei, maxHei):
199 """
199 """
@@ -208,11 +208,20 class VoltageProcessor:
208 Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex
208 Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex
209
209
210 Return:
210 Return:
211 None
211 1 si el metodo se ejecuto con exito caso contrario devuelve 0
212 """
212 """
213 if self.voltageOutObj.flagNoData:
214 return 0
215
216 if (minHei < self.voltageOutObj.heightList[0]) or (minHei > maxHei):
217 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
218
219 if (maxHei > self.voltageOutObj.heightList[-1]):
220 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
221
213 minIndex = 0
222 minIndex = 0
214 maxIndex = 0
223 maxIndex = 0
215 data = self.dataOutObj.heightList
224 data = self.voltageOutObj.heightList
216
225
217 for i,val in enumerate(data):
226 for i,val in enumerate(data):
218 if val < minHei:
227 if val < minHei:
@@ -228,6 +237,7 class VoltageProcessor:
228 break
237 break
229
238
230 self.selectHeightsByIndex(minIndex, maxIndex)
239 self.selectHeightsByIndex(minIndex, maxIndex)
240 return 1
231
241
232
242
233 def selectHeightsByIndex(self, minIndex, maxIndex):
243 def selectHeightsByIndex(self, minIndex, maxIndex):
@@ -236,62 +246,64 class VoltageProcessor:
236 minIndex <= index <= maxIndex
246 minIndex <= index <= maxIndex
237
247
238 Input:
248 Input:
239 minIndex : valor minimo de altura a considerar
249 minIndex : valor de indice minimo de altura a considerar
240 maxIndex : valor maximo de altura a considerar
250 maxIndex : valor de indice maximo de altura a considerar
241
251
242 Affected:
252 Affected:
243 self.voltageOutObj.datablock
253 self.voltageOutObj.data
244 self.voltageOutObj.m_ProcessingHeader.numHeights
254 self.voltageOutObj.heightList
245 self.voltageOutObj.m_ProcessingHeader.blockSize
246 self.voltageOutObj.heightList
247 self.voltageOutObj.nHeights
255 self.voltageOutObj.nHeights
248 self.voltageOutObj.m_RadarControllerHeader.numHeights
256 self.voltageOutObj.m_ProcessingHeader.blockSize
257 self.voltageOutObj.m_ProcessingHeader.numHeights
258 self.voltageOutObj.m_ProcessingHeader.firstHeight
259 self.voltageOutObj.m_RadarControllerHeader
249
260
250 Return:
261 Return:
251 None
262 1 si el metodo se ejecuto con exito caso contrario devuelve 0
252 """
263 """
253 channels = self.voltageOutObj.nChannels
264 if self.voltageOutObj.flagNoData:
254 profiles = self.voltageOutObj.nProfiles
265 return 0
255 newheis = maxIndex - minIndex + 1
266
267 if (minIndex < 0) or (minIndex > maxIndex):
268 raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
269
270 if (maxIndex >= self.voltageOutObj.nHeights):
271 raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
272
273 nHeights = maxIndex - minIndex + 1
256 firstHeight = 0
274 firstHeight = 0
257
275
258 #voltage
276 #voltage
259 data = numpy.zeros( (channels,profiles,newheis), dtype='complex' )
277 data = self.voltageOutObj.data[:,minIndex:maxIndex+1]
260 for i in range(channels):
261 data[i] = self.voltageOutObj.data_spc[i,:,minIndex:maxIndex+1]
262
278
263 self.voltageOutObj.datablock = data
279 firstHeight = self.voltageOutObj.heightList[minIndex]
264
280
265 firstHeight = self.dataOutObj.heightList[minIndex]
281 self.voltageOutObj.data = data
266
282 self.voltageOutObj.heightList = self.voltageOutObj.heightList[minIndex:maxIndex+1]
267 self.voltageOutObj.nHeights = newheis
283 self.voltageOutObj.nHeights = nHeights
268 self.voltageOutObj.m_ProcessingHeader.blockSize = data.size
284 self.voltageOutObj.m_ProcessingHeader.blockSize = data.size
269 self.voltageOutObj.m_ProcessingHeader.numHeights = newheis
285 self.voltageOutObj.m_ProcessingHeader.numHeights = nHeights
270 self.voltageOutObj.m_ProcessingHeader.firstHeight = firstHeight
286 self.voltageOutObj.m_ProcessingHeader.firstHeight = firstHeight
271 self.voltageOutObj.m_RadarControllerHeader = newheis
287 self.voltageOutObj.m_RadarControllerHeader.numHeights = nHeights
272
288 return 1
273 xi = firstHeight
274 step = self.voltageOutObj.m_ProcessingHeader.deltaHeight
275 xf = xi + newheis * step
276 self.voltageOutObj.heightList = numpy.arange(xi, xf, step)
277
289
278
290
279 def selectProfiles(self, minIndex, maxIndex, nProfiles):
291 def selectProfiles(self, minIndex, maxIndex, nProfiles):
280 """
292 """
281 Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango
293 Selecciona un bloque de datos en base a un grupo indices de perfiles segun el rango
282 minIndex <= index <= maxIndex
294 minIndex <= index <= maxIndex
283
295
284 Input:
296 Input:
285 minIndex : valor minimo de altura a considerar
297 minIndex : valor de indice minimo de perfil a considerar
286 maxIndex : valor maximo de altura a considerar
298 maxIndex : valor de indice maximo de perfil a considerar
299 nProfiles : numero de profiles
287
300
288 Affected:
301 Affected:
289 self.voltageOutObj.datablock
302 self.voltageOutObj.flagNoData
290 self.voltageOutObj.m_ProcessingHeader.numHeights
303 self.profSelectorIndex
291 self.voltageOutObj.heightList
292
304
293 Return:
305 Return:
294 None
306 1 si el metodo se ejecuto con exito caso contrario devuelve 0
295 """
307 """
296
308
297 if self.voltageOutObj.flagNoData:
309 if self.voltageOutObj.flagNoData:
@@ -416,7 +428,7 class CoherentIntegrator:
416 class ProfileSelector():
428 class ProfileSelector():
417
429
418 indexProfile = None
430 indexProfile = None
419 # Tamaño total de los perfiles
431 # Tamanho total de los perfiles
420 nProfiles = None
432 nProfiles = None
421
433
422 def __init__(self, nProfiles):
434 def __init__(self, nProfiles):
@@ -426,11 +438,11 class ProfileSelector():
426
438
427 def isProfileInRange(self, minIndex, maxIndex):
439 def isProfileInRange(self, minIndex, maxIndex):
428
440
429 if minIndex < self.indexProfile:
441 if self.indexProfile < minIndex:
430 self.indexProfile += 1
442 self.indexProfile += 1
431 return False
443 return False
432
444
433 if maxIndex > self.indexProfile:
445 if self.indexProfile > maxIndex:
434 self.indexProfile += 1
446 self.indexProfile += 1
435 return False
447 return False
436
448
General Comments 0
You need to be logged in to leave comments. Login now