##// END OF EJS Templates
Adicion del metodo filterByHeights en la clase VoltageProc....
Adicion del metodo filterByHeights en la clase VoltageProc. Adicion de las clases ProfileSelector y Decoder

File last commit:

r169:661bb8af254a
r223:413a7765ec9f
Show More
VoltageProcessor.py
678 lines | 21.9 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
path = os.path.split(os.getcwd())[0]
sys.path.append(path)
from Model.Voltage import Voltage
from IO.VoltageIO import VoltageWriter
from Graphics.VoltagePlot import Osciloscope
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 from Graphics.VoltagePlot import RTI
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
Adicion de directorios de procesamiento y utilitarios
r10 class VoltageProcessor:
'''
classdocs
'''
Miguel Valdez
r99
dataInObj = None
dataOutObj = None
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107
Miguel Valdez
r99 integratorObjIndex = None
decoderObjIndex = None
profSelectorObjIndex = None
writerObjIndex = None
plotterObjIndex = None
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 flipIndex = None
Miguel Valdez
r99
integratorObjList = []
decoderObjList = []
profileSelectorObjList = []
writerObjList = []
plotterObjList = []
m_Voltage= Voltage()
Miguel Valdez
r101
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.profSelectorObjIndex = None
self.writerObjIndex = None
self.plotterObjIndex = None
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 self.flipIndex = 1
Miguel Valdez
r99 self.integratorObjList = []
self.decoderObjList = []
self.profileSelectorObjList = []
self.writerObjList = []
self.plotterObjList = []
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 def setup(self, dataInObj=None, dataOutObj=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 self.dataInObj = dataInObj
if dataOutObj == None:
dataOutObj = Voltage()
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 dataOutObj.copy(dataInObj)
self.dataOutObj = dataOutObj
return self.dataOutObj
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 def init(self):
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Miguel Valdez
r99 self.integratorObjIndex = 0
self.decoderObjIndex = 0
self.profSelectorObjIndex = 0
self.writerObjIndex = 0
self.plotterObjIndex = 0
self.dataOutObj.copy(self.dataInObj)
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100
if self.profSelectorObjIndex != None:
for profSelObj in self.profileSelectorObjList:
profSelObj.incIndex()
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 def addWriter(self, wrpath):
Miguel Valdez
r99 objWriter = VoltageWriter(self.dataOutObj)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 objWriter.setup(wrpath)
Miguel Valdez
r99 self.writerObjList.append(objWriter)
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 addRti(self,index=None):
if index==None:
index = self.plotterObjIndex
plotObj = RTI(self.dataOutObj, index)
self.plotterObjList.append(plotObj)
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103 def addPlotter(self, index=None):
if index==None:
index = self.plotterObjIndex
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103 plotObj = Osciloscope(self.dataOutObj, index)
Miguel Valdez
r99 self.plotterObjList.append(plotObj)
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103
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 objCohInt = CoherentIntegrator(N,timeInterval)
Miguel Valdez
r99 self.integratorObjList.append(objCohInt)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 def addDecoder(self, code, ncode, nbaud):
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
objDecoder = Decoder(code,ncode,nbaud)
Miguel Valdez
r99 self.decoderObjList.append(objDecoder)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 def addProfileSelector(self, nProfiles):
objProfSelector = ProfileSelector(nProfiles)
Miguel Valdez
r99 self.profileSelectorObjList.append(objProfSelector)
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 def writeData(self,wrpath):
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Miguel Valdez
r99 if self.dataOutObj.flagNoData:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 return 0
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
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
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 addScope(self,index=None):
if index==None:
index = self.plotterObjIndex
plotObj = Osciloscope(self.dataOutObj, index)
self.plotterObjList.append(plotObj)
def plotScope(self,
xmin=None,
xmax=None,
ymin=None,
ymax=None,
titleList=None,
xlabelList=None,
ylabelList=None,
winTitle='',
type="power",
index=None):
if self.dataOutObj.flagNoData:
return 0
if len(self.plotterObjList) <= self.plotterObjIndex:
self.addScope(index)
self.plotterObjList[self.plotterObjIndex].plotData(xmin,
xmax,
ymin,
ymax,
titleList,
xlabelList,
ylabelList,
winTitle,
type)
self.plotterObjIndex += 1
def plotRti(self,
xmin=None,
xmax=None,
ymin=None,
ymax=None,
zmin=None,
zmax=None,
titleList=None,
xlabelList=None,
ylabelList=None,
winTitle='',
timezone='lt',
npoints=1000.0,
colormap="br_green",
showColorbar=True,
showPowerProfile=False,
XAxisAsTime=True,
Daniel Valdez
Agregando funciones para guardar graficos del tipo Voltage
r113 save=False,
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 index=None):
if self.dataOutObj.flagNoData:
return 0
if len(self.plotterObjList) <= self.plotterObjIndex:
self.addRti(index)
self.plotterObjList[self.plotterObjIndex].plotData(xmin,
xmax,
ymin,
ymax,
zmin,
zmax,
titleList,
xlabelList,
ylabelList,
winTitle,
timezone,
npoints,
colormap,
showColorbar,
showPowerProfile,
Daniel Valdez
Agregando funciones para guardar graficos del tipo Voltage
r113 XAxisAsTime,
save)
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.plotterObjIndex += 1
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103 def plotData(self,xmin=None, xmax=None, ymin=None, ymax=None, type='iq', winTitle='', index=None):
Miguel Valdez
r99 if self.dataOutObj.flagNoData:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 return 0
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103
Miguel Valdez
r99 if len(self.plotterObjList) <= self.plotterObjIndex:
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103 self.addPlotter(index)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103 self.plotterObjList[self.plotterObjIndex].plotData(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,type=type, winTitle=winTitle)
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):
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Miguel Valdez
r99 if self.dataOutObj.flagNoData:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 return 0
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
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
Miguel Valdez
r99 myCohIntObj = self.integratorObjList[self.integratorObjIndex]
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 myCohIntObj.exe(data=self.dataOutObj.data,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 myCohIntObj.isReady:
Miguel Valdez
r99 self.dataOutObj.data = myCohIntObj.data
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 self.dataOutObj.nAvg = myCohIntObj.navg
self.dataOutObj.m_ProcessingHeader.coherentInt *= myCohIntObj.navg
#print "myCohIntObj.navg: ",myCohIntObj.navg
Miguel Valdez
r99 self.dataOutObj.flagNoData = False
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
else:
Miguel Valdez
r99 self.dataOutObj.flagNoData = True
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 self.integratorObjIndex += 1
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 def decoder(self,code=None, mode = 0):
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Miguel Valdez
r99 if self.dataOutObj.flagNoData:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 return 0
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 if code == None:
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 code = self.dataOutObj.radarControllerHeaderObj.code
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 ncode, nbaud = code.shape
Miguel Valdez
r99 if len(self.decoderObjList) <= self.decoderObjIndex:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.addDecoder(code,ncode,nbaud)
Miguel Valdez
r99 myDecodObj = self.decoderObjList[self.decoderObjIndex]
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 data, ndata = myDecodObj.exe(data=self.dataOutObj.data,mode=mode)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 self.dataOutObj.data = data
self.dataOutObj.nHeights = ndata
self.dataOutObj.heightList = self.dataInObj.heightList[:ndata]
self.dataOutObj.flagNoData = False
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 self.decoderObjIndex += 1
Victor Sarmiento
VoltageProcesor.py:...
r84
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Victor Sarmiento
VoltageProcesor.py:...
r84 def filterByHei(self, window):
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 if window == None:
Miguel Valdez
Se traslado el codigo antiguo a la carpeta old y se creo la estructura de directorios Model, Controller y GUI
r169 window = self.dataOutObj.radarControllerHeaderObj.txA / self.dataOutObj.m_ProcessingHeader.deltaHeight[0]
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100
newdelta = self.dataOutObj.m_ProcessingHeader.deltaHeight[0] * window
dim1 = self.dataOutObj.data.shape[0]
dim2 = self.dataOutObj.data.shape[1]
r = dim2 % window
buffer = self.dataOutObj.data[:,0:dim2-r]
buffer = buffer.reshape(dim1,dim2/window,window)
buffer = numpy.sum(buffer,2)
self.dataOutObj.data = buffer
self.dataOutObj.m_ProcessingHeader.deltaHeight = newdelta
self.dataOutObj.m_ProcessingHeader.numHeights = buffer.shape[1]
self.dataOutObj.nHeights = self.dataOutObj.m_ProcessingHeader.numHeights
#self.dataOutObj.heightList es un numpy.array
self.dataOutObj.heightList = numpy.arange(self.dataOutObj.m_ProcessingHeader.firstHeight[0],newdelta*self.dataOutObj.nHeights,newdelta)
def deFlip(self):
self.dataOutObj.data *= self.flipIndex
self.flipIndex *= -1.
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Victor Sarmiento
VoltageProcesor.py:...
r84 def selectChannels(self, channelList):
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 pass
def selectChannelsByIndex(self, channelIndexList):
Victor Sarmiento
VoltageProcesor.py:...
r84 """
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 Selecciona un bloque de datos en base a canales segun el channelIndexList
Victor Sarmiento
VoltageProcesor.py:...
r84
Input:
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7]
Victor Sarmiento
VoltageProcesor.py:...
r84
Affected:
Victor Sarmiento
VoltageProcessor.py:...
r97 self.dataOutObj.data
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.dataOutObj.channelIndexList
Victor Sarmiento
VoltageProcesor.py:...
r84 self.dataOutObj.nChannels
Miguel Valdez
r99 self.dataOutObj.m_ProcessingHeader.totalSpectra
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
Miguel Valdez
r99 self.dataOutObj.m_ProcessingHeader.blockSize
Victor Sarmiento
VoltageProcesor.py:...
r84
Return:
None
"""
Miguel Valdez
r99 if self.dataOutObj.flagNoData:
Victor Sarmiento
VoltageProcessor.py:...
r97 return 0
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 for channel in channelIndexList:
if channel not in self.dataOutObj.channelIndexList:
raise ValueError, "The value %d in channelIndexList is not valid" %channel
Victor Sarmiento
VoltageProcesor.py:...
r84
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 nChannels = len(channelIndexList)
Miguel Valdez
r101
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 data = self.dataOutObj.data[channelIndexList,:]
Miguel Valdez
r101
Miguel Valdez
r99 self.dataOutObj.data = data
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.dataOutObj.channelIndexList = channelIndexList
Miguel Valdez
r101 self.dataOutObj.nChannels = nChannels
Daniel Valdez
Changing the Model for the input Objects in Processing package...
r107 self.dataOutObj.m_ProcessingHeader.totalSpectra = 0
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
r99 self.dataOutObj.m_ProcessingHeader.blockSize = data.size
Victor Sarmiento
VoltageProcessor.py:...
r97 return 1
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Victor Sarmiento
VoltageProcesor.py:...
r84 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:
Victor Sarmiento
VoltageProcessor.py:...
r97 1 si el metodo se ejecuto con exito caso contrario devuelve 0
Victor Sarmiento
VoltageProcesor.py:...
r84 """
Miguel Valdez
r99 if self.dataOutObj.flagNoData:
Victor Sarmiento
VoltageProcessor.py:...
r97 return 0
Miguel Valdez
r99 if (minHei < self.dataOutObj.heightList[0]) or (minHei > maxHei):
Victor Sarmiento
VoltageProcessor.py:...
r97 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
Miguel Valdez
r99 if (maxHei > self.dataOutObj.heightList[-1]):
Victor Sarmiento
VoltageProcessor.py:...
r97 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
Victor Sarmiento
VoltageProcesor.py:...
r84 minIndex = 0
maxIndex = 0
Miguel Valdez
r99 data = self.dataOutObj.heightList
Victor Sarmiento
VoltageProcesor.py:...
r84
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)
Victor Sarmiento
VoltageProcessor.py:...
r97 return 1
Victor Sarmiento
VoltageProcesor.py:...
r84
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:
Victor Sarmiento
VoltageProcessor.py:...
r97 minIndex : valor de indice minimo de altura a considerar
maxIndex : valor de indice maximo de altura a considerar
Victor Sarmiento
VoltageProcesor.py:...
r84
Affected:
Miguel Valdez
r99 self.dataOutObj.data
self.dataOutObj.heightList
self.dataOutObj.nHeights
self.dataOutObj.m_ProcessingHeader.blockSize
self.dataOutObj.m_ProcessingHeader.numHeights
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
Victor Sarmiento
VoltageProcesor.py:...
r84
Return:
Victor Sarmiento
VoltageProcessor.py:...
r97 1 si el metodo se ejecuto con exito caso contrario devuelve 0
Victor Sarmiento
VoltageProcesor.py:...
r84 """
Miguel Valdez
r99 if self.dataOutObj.flagNoData:
Victor Sarmiento
VoltageProcessor.py:...
r97 return 0
if (minIndex < 0) or (minIndex > maxIndex):
raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
Miguel Valdez
r99 if (maxIndex >= self.dataOutObj.nHeights):
Victor Sarmiento
VoltageProcessor.py:...
r97 raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
nHeights = maxIndex - minIndex + 1
Victor Sarmiento
VoltageProcesor.py:...
r84
#voltage
Miguel Valdez
r99 data = self.dataOutObj.data[:,minIndex:maxIndex+1]
Victor Sarmiento
VoltageProcesor.py:...
r84
Miguel Valdez
r99 firstHeight = self.dataOutObj.heightList[minIndex]
Victor Sarmiento
VoltageProcesor.py:...
r84
Miguel Valdez
r99 self.dataOutObj.data = data
self.dataOutObj.heightList = self.dataOutObj.heightList[minIndex:maxIndex+1]
self.dataOutObj.nHeights = nHeights
self.dataOutObj.m_ProcessingHeader.blockSize = data.size
self.dataOutObj.m_ProcessingHeader.numHeights = nHeights
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
VoltageProcessor.py:...
r97 return 1
Victor Sarmiento
VoltageProcesor.py:...
r84
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 def selectProfilesByValue(self,indexList, nProfiles):
if self.dataOutObj.flagNoData:
return 0
if self.profSelectorObjIndex >= len(self.profileSelectorObjList):
self.addProfileSelector(nProfiles)
profileSelectorObj = self.profileSelectorObjList[self.profSelectorObjIndex]
if not(profileSelectorObj.isProfileInList(indexList)):
self.dataOutObj.flagNoData = True
self.profSelectorObjIndex += 1
return 0
self.dataOutObj.flagNoData = False
self.profSelectorObjIndex += 1
return 1
Victor Sarmiento
VoltageProcesor.py:...
r84
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 def selectProfilesByIndex(self, minIndex, maxIndex, nProfiles):
Victor Sarmiento
VoltageProcesor.py:...
r84 """
Victor Sarmiento
VoltageProcessor.py:...
r97 Selecciona un bloque de datos en base a un grupo indices de perfiles segun el rango
Victor Sarmiento
VoltageProcesor.py:...
r84 minIndex <= index <= maxIndex
Input:
Victor Sarmiento
VoltageProcessor.py:...
r97 minIndex : valor de indice minimo de perfil a considerar
maxIndex : valor de indice maximo de perfil a considerar
nProfiles : numero de profiles
Victor Sarmiento
VoltageProcesor.py:...
r84
Affected:
Miguel Valdez
r99 self.dataOutObj.flagNoData
self.profSelectorObjIndex
Victor Sarmiento
VoltageProcesor.py:...
r84
Return:
Victor Sarmiento
VoltageProcessor.py:...
r97 1 si el metodo se ejecuto con exito caso contrario devuelve 0
Victor Sarmiento
VoltageProcesor.py:...
r84 """
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Miguel Valdez
r99 if self.dataOutObj.flagNoData:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 return 0
Miguel Valdez
r99 if self.profSelectorObjIndex >= len(self.profileSelectorObjList):
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 self.addProfileSelector(nProfiles)
Miguel Valdez
r99 profileSelectorObj = self.profileSelectorObjList[self.profSelectorObjIndex]
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 if not(profileSelectorObj.isProfileInRange(minIndex, maxIndex)):
self.dataOutObj.flagNoData = True
Miguel Valdez
r99 self.profSelectorObjIndex += 1
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 return 0
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 self.dataOutObj.flagNoData = False
Miguel Valdez
r99 self.profSelectorObjIndex += 1
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 return 1
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Victor Sarmiento
VoltageProcesor.py:...
r84 def selectNtxs(self, ntx):
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 pass
class Decoder:
Miguel Valdez
r99
data = None
profCounter = 1
Miguel Valdez
r101 nCode = None
nBaud = None
Miguel Valdez
r99 codeIndex = 0
Miguel Valdez
r101 code = None
Miguel Valdez
r99 flag = False
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 def __init__(self,code, ncode, nbaud):
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Miguel Valdez
r99 self.data = None
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 self.ndata = None
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.profCounter = 1
self.nCode = ncode
self.nBaud = nbaud
self.codeIndex = 0
self.code = code #this is a List
self.flag = False
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 def exe(self, data, ndata=None, mode = 0):
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
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 ndata == None: ndata = data.shape[1]
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 if mode == 0:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.convolutionInFreq(data,ndata)
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 if mode == 1:
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.convolutionInTime(data, ndata)
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116
self.ndata = ndata - self.nBaud + 1
return self.data, self.ndata
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 def convolutionInFreq(self,data, ndata):
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
newcode = numpy.zeros(ndata)
newcode[0:self.nBaud] = self.code[self.codeIndex]
self.codeIndex += 1
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 fft_data = numpy.fft.fft(data, axis=1)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 fft_code = numpy.conj(numpy.fft.fft(newcode))
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 fft_code = fft_code.reshape(1,len(fft_code))
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
conv = fft_data.copy()
conv.fill(0)
Miguel Valdez
r101 conv = fft_data*fft_code
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 data = numpy.fft.ifft(conv,axis=1)
self.data = data[:,:-self.nBaud+1]
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 self.flag = True
if self.profCounter == self.nCode:
self.profCounter = 0
self.codeIndex = 0
self.profCounter += 1
def convolutionInTime(self, data, ndata):
nchannel = data.shape[1]
newcode = self.code[self.codeIndex]
self.codeIndex += 1
conv = data.copy()
for i in range(nchannel):
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 conv[i,:] = numpy.correlate(data[i,:], newcode)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
self.data = conv
self.flag = True
if self.profCounter == self.nCode:
self.profCounter = 0
self.codeIndex = 0
self.profCounter += 1
class CoherentIntegrator:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
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
Miguel Valdez
r101 nCohInt = None
Miguel Valdez
r99
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 def __init__(self, N=None,timeInterval=None):
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
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.nCohInt = 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)):
Miguel Valdez
El numero de alturas son actualizadas cuando se realiza la decodificación nHeigths = nHeigths - nBauds + 1
r116 raise ValueError, "N = None ; timeInterval = None"
if timeInterval == None:
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 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):
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.nCohInt:
if self.buffer == None:
self.buffer = data
else:
self.buffer = self.buffer + data
self.integ_counter += 1
if self.integ_counter == self.nCohInt:
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
if self.timeFlag:
self.buffer = data
self.timeOut = timeOfData + self.timeIntervalInSeconds
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 else:
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104 self.isReady = False
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Daniel Valdez
Adding the first version of Controller.py and experiment.cfg....
r104
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 class ProfileSelector:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 profileIndex = None
Victor Sarmiento
VoltageProcessor.py:...
r97 # Tamanho total de los perfiles
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 nProfiles = None
def __init__(self, nProfiles):
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 self.profileIndex = 0
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 self.nProfiles = nProfiles
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 def incIndex(self):
self.profileIndex += 1
if self.profileIndex >= self.nProfiles:
self.profileIndex = 0
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 def isProfileInRange(self, minIndex, maxIndex):
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 if self.profileIndex < minIndex:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 return False
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 if self.profileIndex > maxIndex:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 return False
return True
def isProfileInList(self, profileList):
Daniel Valdez
Desarrollo de codigo para el calculo de Correlaciones....
r100 if self.profileIndex not in profileList:
Miguel Valdez
El metodo y la clase selector de perfiles han sido añadidos
r92 return False
return True
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72