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