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