##// END OF EJS Templates
SpectraProcessor.py:...
Victor Sarmiento -
r96:ea57c74c6fbd
parent child
Show More
@@ -174,10 +174,6 class SpectraProcessor:
174 174 k += 2
175 175
176 176 self.dataOutObj.m_ProcessingHeader.spectraComb = spectraComb
177
178 #self.selectHeightsByIndex( 0,10)
179 #self.selectHeightsByValue( 120,200 )
180 #self.selectChannels((2,4,5), self.pairList)
181 177
182 178
183 179 def addWriter(self,wrpath):
@@ -285,21 +281,30 class SpectraProcessor:
285 281 if self.dataOutObj.flagNoData:
286 282 return 0
287 283
284 channelIndexList = []
285 for channel in channelList:
286 if channel in self.dataOutObj.channelList:
287 index = self.dataOutObj.channelList.index(channel)
288 channelIndexList.append(index)
289 continue
290
291 raise ValueError, "The value %d in channelList is not valid" %channel
292
288 293 nProfiles = self.dataOutObj.nProfiles
289 dataType = self.dataOutObj.dataType
290 nHeights = self.dataOutObj.m_ProcessingHeader.numHeights
294 #dataType = self.dataOutObj.dataType
295 nHeights = self.dataOutObj.nHeights #m_ProcessingHeader.numHeights
291 296 blocksize = 0
292 297
293 298 #self spectra
294 nChannels = len(channelList)
295 spc = numpy.zeros( (nChannels,nProfiles,nHeights), dataType[0] )
299 nChannels = len(channelIndexList)
300 spc = numpy.zeros( (nChannels,nProfiles,nHeights), dtype='float' ) #dataType[0] )
296 301
297 for index, channel in enumerate(channelList):
298 spc[index,:,:] = self.dataOutObj.data_spc[channel,:,:]
302 for index, channel in enumerate(channelIndexList):
303 spc[index,:,:] = self.dataOutObj.data_spc[index,:,:]
299 304
300 305 #DC channel
301 306 dc = numpy.zeros( (nChannels,nHeights), dtype='complex' )
302 for index, channel in enumerate(channelList):
307 for index, channel in enumerate(channelIndexList):
303 308 dc[index,:] = self.dataOutObj.data_dc[channel,:]
304 309
305 310 blocksize += dc.size
@@ -311,7 +316,7 class SpectraProcessor:
311 316 if pairList == None:
312 317 pairList = self.pairList
313 318
314 if pairList != None:
319 if (pairList != None) and (self.dataOutObj.data_cspc != None):
315 320 #cross spectra
316 321 nPairs = len(pairList)
317 322 cspc = numpy.zeros( (nPairs,nProfiles,nHeights), dtype='complex' )
@@ -319,14 +324,14 class SpectraProcessor:
319 324 spectraComb = self.dataOutObj.m_ProcessingHeader.spectraComb
320 325 totalSpectra = len(spectraComb)
321 326 nchan = self.dataOutObj.nChannels
322 indexList = []
327 pairIndexList = []
323 328
324 329 for pair in pairList: #busco el par en la lista de pares del Spectra Combinations
325 330 for index in range(0,totalSpectra,2):
326 331 if pair[0] == spectraComb[index] and pair[1] == spectraComb[index+1]:
327 indexList.append( index/2 - nchan )
332 pairIndexList.append( index/2 - nchan )
328 333
329 for index, pair in enumerate(indexList):
334 for index, pair in enumerate(pairIndexList):
330 335 cspc[index,:,:] = self.dataOutObj.data_cspc[pair,:,:]
331 336 blocksize += cspc.size
332 337
@@ -383,6 +388,12 class SpectraProcessor:
383 388 if self.dataOutObj.flagNoData:
384 389 return 0
385 390
391 if (minHei < self.dataOutObj.heightList[0]) or (minHei > maxHei):
392 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
393
394 if (maxHei > self.dataOutObj.heightList[-1]):
395 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
396
386 397 minIndex = 0
387 398 maxIndex = 0
388 399 data = self.dataOutObj.heightList
@@ -430,44 +441,47 class SpectraProcessor:
430 441 if self.dataOutObj.flagNoData:
431 442 return 0
432 443
444 if (minIndex < 0) or (minIndex > maxIndex):
445 raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
446
447 if (maxIndex >= self.dataOutObj.nHeights):
448 raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
449
433 450 nChannels = self.dataOutObj.nChannels
434 451 nPairs = self.dataOutObj.nPairs
435 452 nProfiles = self.dataOutObj.nProfiles
436 453 dataType = self.dataOutObj.dataType
437 newheis = maxIndex - minIndex + 1
454 nHeights = maxIndex - minIndex + 1
438 455 blockSize = 0
439 456
440 457 #self spectra
441 spc = numpy.zeros( (nChannels,nProfiles,newheis), dataType[0] )
442 for i in range(nChannels):
443 spc[i,:,:] = self.dataOutObj.data_spc[i,:,minIndex:maxIndex+1]
458 spc = self.dataOutObj.data_spc[:,:,minIndex:maxIndex+1]
459 blockSize += spc.size
444 460
445 461 #cross spectra
446 cspc = numpy.zeros( (nPairs,nProfiles,newheis), dtype='complex')
447 for i in range(nPairs):
448 cspc[i,:,:] = self.dataOutObj.data_cspc[i,:,minIndex:maxIndex+1]
462 cspc = None
463 if self.dataOutObj.data_cspc != None:
464 cspc = self.dataOutObj.data_cspc[:,:,minIndex:maxIndex+1]
465 blockSize += cspc.size
449 466
450 467 #DC channel
451 dc = numpy.zeros( (nChannels,newheis), dtype='complex')
452 for i in range(nChannels):
453 dc[i] = self.dataOutObj.data_dc[i,minIndex:maxIndex+1]
468 dc = self.dataOutObj.data_dc[:,minIndex:maxIndex+1]
469 blockSize += dc.size
454 470
455 471 self.dataOutObj.data_spc = spc
456 self.dataOutObj.data_cspc = cspc
472 if cspc != None:
473 self.dataOutObj.data_cspc = cspc
457 474 self.dataOutObj.data_dc = dc
458 475
459 476 firstHeight = self.dataOutObj.heightList[minIndex]
460 477
461 self.dataOutObj.nHeights = newheis
462 self.dataOutObj.m_ProcessingHeader.blockSize = spc.size + cspc.size + dc.size
463 self.dataOutObj.m_ProcessingHeader.numHeights = newheis
478 self.dataOutObj.nHeights = nHeights
479 self.dataOutObj.m_ProcessingHeader.blockSize = blockSize
480 self.dataOutObj.m_ProcessingHeader.numHeights = nHeights
464 481 self.dataOutObj.m_ProcessingHeader.firstHeight = firstHeight
465 self.dataOutObj.m_RadarControllerHeader.numHeights = newheis
482 self.dataOutObj.m_RadarControllerHeader.numHeights = nHeights
466 483
467 xi = firstHeight
468 step = self.dataOutObj.m_ProcessingHeader.deltaHeight
469 xf = xi + newheis * step
470 self.dataOutObj.heightList = numpy.arange(xi, xf, step)
484 self.dataOutObj.heightList = self.dataOutObj.heightList[minIndex:maxIndex+1]
471 485
472 486
473 487 class IncoherentIntegration:
General Comments 0
You need to be logged in to leave comments. Login now