##// END OF EJS Templates
Timezone is taken from data and not from PC
Timezone is taken from data and not from PC

File last commit:

r169:661bb8af254a
r565:9a975da57daf
Show More
SpectraProcessor.py
699 lines | 23.4 KiB | text/x-python | PythonLexer
Miguel Valdez
Adicion de directorios de procesamiento y utilitarios
r10 '''
Created on Feb 7, 2012
Daniel Valdez
Fijando variables svn:keywords Author Id
r16 @author $Author$
@version $Id$
Miguel Valdez
Adicion de directorios de procesamiento y utilitarios
r10 '''
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 import os, sys
import numpy
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112 import time
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
path = os.path.split(os.getcwd())[0]
sys.path.append(path)
from Model.Spectra import Spectra
from IO.SpectraIO import SpectraWriter
from Graphics.SpectraPlot import Spectrum
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 from JRONoise import Noise
Miguel Valdez
Adicion de directorios de procesamiento y utilitarios
r10
class SpectraProcessor:
'''
classdocs
'''
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 dataInObj = None
dataOutObj = None
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 noiseObj = None
Miguel Valdez
r99
integratorObjList = []
decoderObjList = []
writerObjList = []
plotterObjList = []
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 integratorObjIndex = None
decoderObjIndex = None
writerObjIndex = None
plotterObjIndex = None
Miguel Valdez
r99 buffer = None
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 profIndex = 0
Miguel Valdez
r99
nFFTPoints = None
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 nChannels = None
nHeights = None
nPairs = None
Miguel Valdez
r99 pairList = None
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 def __init__(self):
Miguel Valdez
Adicion de directorios de procesamiento y utilitarios
r10 '''
Constructor
'''
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 self.integratorObjIndex = None
self.decoderObjIndex = None
self.writerObjIndex = None
self.plotterObjIndex = None
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 self.integratorObjList = []
self.decoderObjList = []
self.writerObjList = []
self.plotterObjList = []
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
Bug en el calculo del numero de integraciones incoherentes
r115 self.noiseObj = None
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.buffer = None
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.profIndex = 0
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 def setup(self, dataInObj=None, dataOutObj=None, nFFTPoints=None, pairList=None):
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 if dataInObj == None:
raise ValueError, ""
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103
Victor Sarmiento
SpectraProcessor.py:...
r85 if nFFTPoints == None:
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 raise ValueError, ""
self.dataInObj = dataInObj
Victor Sarmiento
SpectraProcessor.py:...
r85
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 if dataOutObj == None:
dataOutObj = Spectra()
self.dataOutObj = dataOutObj
self.noiseObj = Noise()
##########################################
Victor Sarmiento
SpectraProcessor.py:...
r85 self.nFFTPoints = nFFTPoints
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.nChannels = self.dataInObj.nChannels
self.nHeights = self.dataInObj.nHeights
Victor Sarmiento
SpectraProcessor.py:...
r85 self.pairList = pairList
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 if pairList != None:
self.nPairs = len(pairList)
else:
self.nPairs = 0
self.dataOutObj.heightList = self.dataInObj.heightList
self.dataOutObj.channelIndexList = self.dataInObj.channelIndexList
self.dataOutObj.m_BasicHeader = self.dataInObj.m_BasicHeader.copy()
self.dataOutObj.m_ProcessingHeader = self.dataInObj.m_ProcessingHeader.copy()
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 self.dataOutObj.radarControllerHeaderObj = self.dataInObj.radarControllerHeaderObj.copy()
self.dataOutObj.systemHeaderObj = self.dataInObj.systemHeaderObj.copy()
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107
self.dataOutObj.dataType = self.dataInObj.dataType
self.dataOutObj.nPairs = self.nPairs
self.dataOutObj.nChannels = self.nChannels
self.dataOutObj.nProfiles = self.nFFTPoints
self.dataOutObj.nHeights = self.nHeights
self.dataOutObj.nFFTPoints = self.nFFTPoints
#self.dataOutObj.data = None
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 self.dataOutObj.systemHeaderObj.numChannels = self.nChannels
self.dataOutObj.systemHeaderObj.nProfiles = self.nFFTPoints
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107
self.dataOutObj.m_ProcessingHeader.totalSpectra = self.nChannels + self.nPairs
self.dataOutObj.m_ProcessingHeader.profilesPerBlock = self.nFFTPoints
self.dataOutObj.m_ProcessingHeader.numHeights = self.nHeights
self.dataOutObj.m_ProcessingHeader.shif_fft = True
spectraComb = numpy.zeros( (self.nChannels+self.nPairs)*2,numpy.dtype('u1'))
k = 0
for i in range( 0,self.nChannels*2,2 ):
spectraComb[i] = k
spectraComb[i+1] = k
k += 1
k *= 2
if self.pairList != None:
for pair in self.pairList:
spectraComb[k] = pair[0]
spectraComb[k+1] = pair[1]
k += 2
self.dataOutObj.m_ProcessingHeader.spectraComb = spectraComb
return self.dataOutObj
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103
def init(self):
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 self.nHeights = self.dataInObj.nHeights
self.dataOutObj.nHeights = self.nHeights
self.dataOutObj.heightList = self.dataInObj.heightList
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103 self.integratorObjIndex = 0
self.decoderObjIndex = 0
self.writerObjIndex = 0
self.plotterObjIndex = 0
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 if self.dataInObj.type == "Voltage":
if self.buffer == None:
self.buffer = numpy.zeros((self.nChannels,
self.nFFTPoints,
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 self.dataInObj.nHeights),
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 dtype='complex')
self.buffer[:,self.profIndex,:] = self.dataInObj.data
self.profIndex += 1
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112 if self.profIndex == self.nFFTPoints:
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.__getFft()
self.dataOutObj.flagNoData = False
self.buffer = None
self.profIndex = 0
return
self.dataOutObj.flagNoData = True
return
#Other kind of data
if self.dataInObj.type == "Spectra":
Victor Sarmiento
SpectraProcessor.py:...
r85 self.dataOutObj.copy(self.dataInObj)
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.dataOutObj.flagNoData = False
return
raise ValueError, "The datatype is not valid"
Victor Sarmiento
SpectraProcessor.py:...
r85 def __getFft(self):
"""
Convierte valores de Voltaje a Spectra
Affected:
self.dataOutObj.data_spc
self.dataOutObj.data_cspc
self.dataOutObj.data_dc
self.dataOutObj.heightList
self.dataOutObj.m_BasicHeader
self.dataOutObj.m_ProcessingHeader
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 self.dataOutObj.radarControllerHeaderObj
self.dataOutObj.systemHeaderObj
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.profIndex
Victor Sarmiento
SpectraProcessor.py:...
r85 self.buffer
self.dataOutObj.flagNoData
self.dataOutObj.dataType
self.dataOutObj.nPairs
self.dataOutObj.nChannels
self.dataOutObj.nProfiles
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 self.dataOutObj.systemHeaderObj.numChannels
Victor Sarmiento
SpectraProcessor.py:...
r85 self.dataOutObj.m_ProcessingHeader.totalSpectra
self.dataOutObj.m_ProcessingHeader.profilesPerBlock
self.dataOutObj.m_ProcessingHeader.numHeights
self.dataOutObj.m_ProcessingHeader.spectraComb
self.dataOutObj.m_ProcessingHeader.shif_fft
"""
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 if self.dataInObj.flagNoData:
return 0
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Victor Sarmiento
SpectraProcessor.py:...
r85 fft_volt = numpy.fft.fft(self.buffer,axis=1)
dc = fft_volt[:,0,:]
#calculo de self-spectra
fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,))
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112 spc = fft_volt * numpy.conjugate(fft_volt)
spc = spc.real
Victor Sarmiento
SpectraProcessor.py:...
r85
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 blocksize = 0
Victor Sarmiento
SpectraProcessor.py:...
r85 blocksize += dc.size
blocksize += spc.size
cspc = None
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 pairIndex = 0
Victor Sarmiento
SpectraProcessor.py:...
r85 if self.pairList != None:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 #calculo de cross-spectra
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 cspc = numpy.zeros((self.nPairs, self.nFFTPoints, self.nHeights), dtype='complex')
Victor Sarmiento
SpectraProcessor.py:...
r85 for pair in self.pairList:
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 cspc[pairIndex,:,:] = numpy.abs(fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:]))
pairIndex += 1
Victor Sarmiento
SpectraProcessor.py:...
r85 blocksize += cspc.size
self.dataOutObj.data_spc = spc
self.dataOutObj.data_cspc = cspc
self.dataOutObj.data_dc = dc
self.dataOutObj.m_ProcessingHeader.blockSize = blocksize
Daniel Valdez
Esta version actualiza las librerias de ploteo para graficos RTI, Spectra y Scope, tambien se agregan metodos para procesamiento de Spectra y Voltage. En el caso de Voltage, en la Integracion Coherente se realiza indicando el tiempo de integracion en minutos.
r108 self.dataOutObj.m_BasicHeader.utc = self.dataInObj.m_BasicHeader.utc
Daniel Valdez
Getnoise se agrega al metodo getFft de SpectraProcessor.
r111
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112 # self.getNoise()
Daniel Valdez
Se ha definido que el arreglo de datos debe tener el formato [canales, perfiles, alturas]; se han modificado los metodos de lectura, escritura, ploteo, procesamiento que estan relacionados.
r73
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 def addWriter(self,wrpath):
Victor Sarmiento
SpectraProcessor.py:...
r85 objWriter = SpectraWriter(self.dataOutObj)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 objWriter.setup(wrpath)
Miguel Valdez
r99 self.writerObjList.append(objWriter)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Esta version actualiza las librerias de ploteo para graficos RTI, Spectra y Scope, tambien se agregan metodos para procesamiento de Spectra y Voltage. En el caso de Voltage, en la Integracion Coherente se realiza indicando el tiempo de integracion en minutos.
r108 def addPlotter(self,index=None):
Daniel Valdez
Se ha definido que el arreglo de datos debe tener el formato [canales, perfiles, alturas]; se han modificado los metodos de lectura, escritura, ploteo, procesamiento que estan relacionados.
r73 if index==None:
Miguel Valdez
r99 index = self.plotterObjIndex
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Victor Sarmiento
SpectraProcessor.py:...
r85 plotObj = Spectrum(self.dataOutObj, index)
Miguel Valdez
r99 self.plotterObjList.append(plotObj)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 def addIntegrator(self,N,timeInterval):
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 objIncohInt = IncoherentIntegration(N,timeInterval)
Miguel Valdez
r99 self.integratorObjList.append(objIncohInt)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Victor Sarmiento
SpectraProcessor.py:...
r85 def writeData(self, wrpath):
if self.dataOutObj.flagNoData:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 return 0
Miguel Valdez
r99 if len(self.writerObjList) <= self.writerObjIndex:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.addWriter(wrpath)
Miguel Valdez
r99 self.writerObjList[self.writerObjIndex].putData()
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 self.writerObjIndex += 1
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Esta version actualiza las librerias de ploteo para graficos RTI, Spectra y Scope, tambien se agregan metodos para procesamiento de Spectra y Voltage. En el caso de Voltage, en la Integracion Coherente se realiza indicando el tiempo de integracion en minutos.
r108 def plotData(self,
xmin=None,
xmax=None,
ymin=None,
ymax=None,
zmin=None,
zmax=None,
titleList=None,
xlabelList=None,
ylabelList=None,
winTitle='',
colormap="br_green",
showColorbar=False,
showPowerProfile=False,
XAxisAsTime=False,
Daniel Valdez
Correcciones y se agrega metodo para guardar plots en disco, aun no funciona satisfactoriamente
r110 save=False,
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112 index=None,
channelList=[]):
Daniel Valdez
Esta version actualiza las librerias de ploteo para graficos RTI, Spectra y Scope, tambien se agregan metodos para procesamiento de Spectra y Voltage. En el caso de Voltage, en la Integracion Coherente se realiza indicando el tiempo de integracion en minutos.
r108
Victor Sarmiento
SpectraProcessor.py:...
r85 if self.dataOutObj.flagNoData:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 return 0
Miguel Valdez
r99 if len(self.plotterObjList) <= self.plotterObjIndex:
Daniel Valdez
Se ha definido que el arreglo de datos debe tener el formato [canales, perfiles, alturas]; se han modificado los metodos de lectura, escritura, ploteo, procesamiento que estan relacionados.
r73 self.addPlotter(index)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Esta version actualiza las librerias de ploteo para graficos RTI, Spectra y Scope, tambien se agregan metodos para procesamiento de Spectra y Voltage. En el caso de Voltage, en la Integracion Coherente se realiza indicando el tiempo de integracion en minutos.
r108 self.plotterObjList[self.plotterObjIndex].plotData(xmin,
xmax,
ymin,
ymax,
zmin,
zmax,
titleList,
xlabelList,
ylabelList,
winTitle,
colormap,
showColorbar,
showPowerProfile,
Daniel Valdez
Correcciones y se agrega metodo para guardar plots en disco, aun no funciona satisfactoriamente
r110 XAxisAsTime,
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112 save,
channelList)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 self.plotterObjIndex += 1
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 def integrator(self, N=None, timeInterval=None):
Victor Sarmiento
SpectraProcessor.py:...
r85 if self.dataOutObj.flagNoData:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 return 0
Miguel Valdez
r99 if len(self.integratorObjList) <= self.integratorObjIndex:
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 self.addIntegrator(N,timeInterval)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 myIncohIntObj = self.integratorObjList[self.integratorObjIndex]
myIncohIntObj.exe(data=self.dataOutObj.data_spc,timeOfData=self.dataOutObj.m_BasicHeader.utc)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 if myIncohIntObj.isReady:
self.dataOutObj.data_spc = myIncohIntObj.data
self.dataOutObj.nAvg = myIncohIntObj.navg
Miguel Valdez
Bug en el calculo del numero de integraciones incoherentes
r115 self.dataOutObj.m_ProcessingHeader.incoherentInt = self.dataInObj.m_ProcessingHeader.incoherentInt*myIncohIntObj.navg
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 #print "myIncohIntObj.navg: ",myIncohIntObj.navg
Victor Sarmiento
SpectraProcessor.py:...
r85 self.dataOutObj.flagNoData = False
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112 """Calcular el ruido"""
self.getNoise()
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 else:
Victor Sarmiento
SpectraProcessor.py:...
r85 self.dataOutObj.flagNoData = True
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 self.integratorObjIndex += 1
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107
Miguel Valdez
Cambio en la forma de generacion de graficos espectrales
r112
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107
Victor Sarmiento
SpectraProcessor.py:...
r85 def removeDC(self, type):
if self.dataOutObj.flagNoData:
return 0
def removeInterference(self):
if self.dataOutObj.flagNoData:
return 0
def removeSatellites(self):
if self.dataOutObj.flagNoData:
return 0
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 def getNoise(self, type="hildebrand", parm=None):
Daniel Valdez
Getnoise se agrega al metodo getFft de SpectraProcessor.
r111 if parm == None:
parm =self.dataOutObj.m_ProcessingHeader.incoherentInt
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.noiseObj.setNoise(self.dataOutObj.data_spc)
if type == "hildebrand":
noise = self.noiseObj.byHildebrand(parm)
if type == "window":
noise = self.noiseObj.byWindow(parm)
if type == "sort":
noise = self.noiseObj.bySort(parm)
self.dataOutObj.noise = noise
Daniel Valdez
Esta version actualiza las librerias de ploteo para graficos RTI, Spectra y Scope, tambien se agregan metodos para procesamiento de Spectra y Voltage. En el caso de Voltage, en la Integracion Coherente se realiza indicando el tiempo de integracion en minutos.
r108 # print 10*numpy.log10(noise)
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107
def selectChannels(self, channelList, pairList=[]):
channelIndexList = []
for channel in channelList:
if channel in self.dataOutObj.channelList:
index = self.dataOutObj.channelList.index(channel)
channelIndexList.append(index)
pairIndexList = []
for pair in pairList:
if pair in self.dataOutObj.pairList:
index = self.dataOutObj.pairList.index(pair)
pairIndexList.append(index)
self.selectChannelsByIndex(channelIndexList, pairIndexList)
def selectChannelsByIndex(self, channelIndexList, pairIndexList=[]):
Victor Sarmiento
SpectraProcessor.py:...
r85 """
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 Selecciona un bloque de datos en base a canales y pares segun el
channelIndexList y el pairIndexList
Victor Sarmiento
SpectraProcessor.py:...
r85
Input:
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 channelIndexList : lista de indices de los canales a seleccionar por ej.
Si tenemos los canales
self.channelList = (2,3,5,7)
y deseamos escoger los canales (3,7)
entonces colocaremos el parametro
channelndexList = (1,3)
pairIndexList : tupla de indice depares que se desea selecionar por ej.
Si tenemos los pares :
( (0,1), (0,2), (1,3), (2,5) )
y deseamos seleccionar los pares ((0,2), (2,5))
entonces colocaremos el parametro
pairIndexList = (1,3)
Victor Sarmiento
SpectraProcessor.py:...
r85
Affected:
self.dataOutObj.data_spc
self.dataOutObj.data_cspc
self.dataOutObj.data_dc
self.dataOutObj.nChannels
self.dataOutObj.nPairs
self.dataOutObj.m_ProcessingHeader.spectraComb
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 self.dataOutObj.systemHeaderObj.numChannels
Victor Sarmiento
SpectraProcessor.py:...
r85
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.dataOutObj.noise
Victor Sarmiento
SpectraProcessor.py:...
r85 Return:
None
"""
if self.dataOutObj.flagNoData:
return 0
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 if pairIndexList == []:
pairIndexList = numpy.arange(len(self.dataOutObj.pairList))
Victor Sarmiento
SpectraProcessor.py:...
r96 nChannels = len(channelIndexList)
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 nPairs = len(pairIndexList)
Victor Sarmiento
SpectraProcessor.py:...
r85
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 blocksize = 0
#self spectra
spc = self.dataOutObj.data_spc[channelIndexList,:,:]
Victor Sarmiento
SpectraProcessor.py:...
r85 blocksize += spc.size
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 cspc = None
if pairIndexList != []:
cspc = self.dataOutObj.data_cspc[pairIndexList,:,:]
Victor Sarmiento
SpectraProcessor.py:...
r85 blocksize += cspc.size
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 #DC channel
dc = None
if self.dataOutObj.m_ProcessingHeader.flag_dc:
dc = self.dataOutObj.data_dc[channelIndexList,:]
blocksize += dc.size
#Almacenar las combinaciones de canales y cros espectros
Miguel Valdez
Se ha reordenado las variables
r89 spectraComb = numpy.zeros( (nChannels+nPairs)*2,numpy.dtype('u1'))
Victor Sarmiento
SpectraProcessor.py:...
r85 i = 0
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 for spcChannel in channelIndexList:
spectraComb[i] = spcChannel
spectraComb[i+1] = spcChannel
Victor Sarmiento
SpectraProcessor.py:...
r85 i += 2
if pairList != None:
for pair in pairList:
spectraComb[i] = pair[0]
spectraComb[i+1] = pair[1]
i += 2
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107
#######
Victor Sarmiento
SpectraProcessor.py:...
r85 self.dataOutObj.data_spc = spc
self.dataOutObj.data_cspc = cspc
self.dataOutObj.data_dc = dc
Miguel Valdez
Se ha reordenado las variables
r89 self.dataOutObj.nChannels = nChannels
self.dataOutObj.nPairs = nPairs
Victor Sarmiento
SpectraProcessor.py:...
r85
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.dataOutObj.channelIndexList = channelIndexList
Victor Sarmiento
SpectraProcessor.py:...
r85
self.dataOutObj.m_ProcessingHeader.spectraComb = spectraComb
Miguel Valdez
Se ha reordenado las variables
r89 self.dataOutObj.m_ProcessingHeader.totalSpectra = nChannels + nPairs
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 self.dataOutObj.systemHeaderObj.numChannels = nChannels
Miguel Valdez
Se ha reordenado las variables
r89 self.dataOutObj.nChannels = nChannels
Victor Sarmiento
SpectraProcessor.py:...
r85 self.dataOutObj.m_ProcessingHeader.blockSize = blocksize
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107
if cspc == None:
self.dataOutObj.m_ProcessingHeader.flag_dc = False
if dc == None:
self.dataOutObj.m_ProcessingHeader.flag_cpsc = False
Victor Sarmiento
SpectraProcessor.py:...
r85 def selectHeightsByValue(self, minHei, maxHei):
"""
Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango
minHei <= height <= maxHei
Input:
minHei : valor minimo de altura a considerar
maxHei : valor maximo de altura a considerar
Affected:
Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex
Return:
None
"""
if self.dataOutObj.flagNoData:
return 0
Victor Sarmiento
SpectraProcessor.py:...
r96 if (minHei < self.dataOutObj.heightList[0]) or (minHei > maxHei):
raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
if (maxHei > self.dataOutObj.heightList[-1]):
raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
Victor Sarmiento
SpectraProcessor.py:...
r85 minIndex = 0
maxIndex = 0
data = self.dataOutObj.heightList
for i,val in enumerate(data):
if val < minHei:
continue
else:
minIndex = i;
break
for i,val in enumerate(data):
if val <= maxHei:
maxIndex = i;
else:
break
self.selectHeightsByIndex(minIndex, maxIndex)
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104
Victor Sarmiento
SpectraProcessor.py:...
r85 def selectHeightsByIndex(self, minIndex, maxIndex):
"""
Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango
minIndex <= index <= maxIndex
Input:
minIndex : valor minimo de altura a considerar
maxIndex : valor maximo de altura a considerar
Affected:
self.dataOutObj.data_spc
self.dataOutObj.data_cspc
self.dataOutObj.data_dc
self.dataOutObj.heightList
self.dataOutObj.nHeights
self.dataOutObj.m_ProcessingHeader.numHeights
self.dataOutObj.m_ProcessingHeader.blockSize
self.dataOutObj.m_ProcessingHeader.firstHeight
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 self.dataOutObj.radarControllerHeaderObj.numHeights
Victor Sarmiento
SpectraProcessor.py:...
r85
Return:
None
"""
if self.dataOutObj.flagNoData:
return 0
Victor Sarmiento
SpectraProcessor.py:...
r96 if (minIndex < 0) or (minIndex > maxIndex):
raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
if (maxIndex >= self.dataOutObj.nHeights):
raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
Miguel Valdez
Se ha reordenado las variables
r89 nChannels = self.dataOutObj.nChannels
nPairs = self.dataOutObj.nPairs
nProfiles = self.dataOutObj.nProfiles
Victor Sarmiento
SpectraProcessor.py:...
r85 dataType = self.dataOutObj.dataType
Victor Sarmiento
SpectraProcessor.py:...
r96 nHeights = maxIndex - minIndex + 1
Victor Sarmiento
SpectraProcessor.py:...
r85 blockSize = 0
#self spectra
Victor Sarmiento
SpectraProcessor.py:...
r96 spc = self.dataOutObj.data_spc[:,:,minIndex:maxIndex+1]
blockSize += spc.size
Victor Sarmiento
SpectraProcessor.py:...
r85
#cross spectra
Victor Sarmiento
SpectraProcessor.py:...
r96 cspc = None
if self.dataOutObj.data_cspc != None:
cspc = self.dataOutObj.data_cspc[:,:,minIndex:maxIndex+1]
blockSize += cspc.size
Victor Sarmiento
SpectraProcessor.py:...
r85
#DC channel
Victor Sarmiento
SpectraProcessor.py:...
r96 dc = self.dataOutObj.data_dc[:,minIndex:maxIndex+1]
blockSize += dc.size
Victor Sarmiento
SpectraProcessor.py:...
r85
self.dataOutObj.data_spc = spc
Victor Sarmiento
SpectraProcessor.py:...
r96 if cspc != None:
self.dataOutObj.data_cspc = cspc
Victor Sarmiento
SpectraProcessor.py:...
r85 self.dataOutObj.data_dc = dc
firstHeight = self.dataOutObj.heightList[minIndex]
Victor Sarmiento
SpectraProcessor.py:...
r96 self.dataOutObj.nHeights = nHeights
self.dataOutObj.m_ProcessingHeader.blockSize = blockSize
self.dataOutObj.m_ProcessingHeader.numHeights = nHeights
Victor Sarmiento
SpectraProcessor.py:...
r85 self.dataOutObj.m_ProcessingHeader.firstHeight = firstHeight
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 self.dataOutObj.radarControllerHeaderObj.numHeights = nHeights
Victor Sarmiento
SpectraProcessor.py:...
r85
Victor Sarmiento
SpectraProcessor.py:...
r96 self.dataOutObj.heightList = self.dataOutObj.heightList[minIndex:maxIndex+1]
Victor Sarmiento
SpectraProcessor.py:...
r85
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 class IncoherentIntegration:
Miguel Valdez
r99
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 integ_counter = None
Miguel Valdez
r99 data = None
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 navg = None
Miguel Valdez
r99 buffer = None
nIncohInt = None
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 def __init__(self, N = None, timeInterval = None):
"""
N
timeInterval - interval time [min], integer value
"""
Miguel Valdez
r99
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.data = None
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 self.navg = None
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.buffer = None
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 self.timeOut = None
self.exitCondition = False
self.isReady = False
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.nIncohInt = N
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 self.integ_counter = 0
if timeInterval!=None:
self.timeIntervalInSeconds = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line
if ((timeInterval==None) and (N==None)):
print 'N = None ; timeInterval = None'
sys.exit(0)
elif timeInterval == None:
self.timeFlag = False
else:
self.timeFlag = True
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 def exe(self,data,timeOfData):
"""
data
timeOfData [seconds]
"""
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 if self.timeFlag:
if self.timeOut == None:
self.timeOut = timeOfData + self.timeIntervalInSeconds
if timeOfData < self.timeOut:
if self.buffer == None:
self.buffer = data
else:
self.buffer = self.buffer + data
self.integ_counter += 1
else:
self.exitCondition = True
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 else:
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 if self.integ_counter < self.nIncohInt:
if self.buffer == None:
self.buffer = data
else:
self.buffer = self.buffer + data
self.integ_counter += 1
if self.integ_counter == self.nIncohInt:
self.exitCondition = True
if self.exitCondition:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.data = self.buffer
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 self.navg = self.integ_counter
self.isReady = True
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.buffer = None
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 self.timeOut = None
self.integ_counter = 0
self.exitCondition = False
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 if self.timeFlag:
self.buffer = data
self.timeOut = timeOfData + self.timeIntervalInSeconds
else:
self.isReady = False