##// END OF EJS Templates

File last commit:

r104:851c0a59dacb
r105:ff2de98458a5
Show More
VoltageProcessor.py
590 lines | 18.5 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
Miguel Valdez
Adicion de directorios de procesamiento y utilitarios
r10 class VoltageProcessor:
'''
classdocs
'''
Miguel Valdez
r99
dataInObj = None
dataOutObj = None
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
Adding the first version of Controller, including some changes in Voltage and Spectra Processors.
r103 def __init__(self, dataInObj=None, dataOutObj=None):
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.dataInObj = dataInObj
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
Miguel Valdez
r99 if dataOutObj == None:
self.dataOutObj = Voltage()
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 else:
Miguel Valdez
r99 self.dataOutObj = dataOutObj
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
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 setIO(self,inputObject, outputObject):
if not( isinstance(inputObject, Voltage) ):
print 'InputObject must be an instance from Voltage()'
sys.exit(0)
if not( isinstance(outputObject, Voltage) ):
print 'OutputObject must be an instance from Voltage()'
sys.exit(0)
self.dataInObj = inputObject
self.dataOutObj = outputObject
def setup(self):
pass
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
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 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 # myWrObj = self.writerObjList[self.writerObjIndex]
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72 # myWrObj.putData()
Miguel Valdez
r99 self.writerObjIndex += 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
def decoder(self,code=None,type = 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
r99 code = self.dataOutObj.m_RadarControllerHeader.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]
myDecodObj.exe(data=self.dataOutObj.data,type=type)
Daniel Valdez
Agregando los metodos para VoltageProcessor y SpectraProcessor.
r72
if myDecodObj.flag:
Miguel Valdez
r99 self.dataOutObj.data = myDecodObj.data
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.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:
window = self.dataOutObj.m_RadarControllerHeader.txA / self.dataOutObj.m_ProcessingHeader.deltaHeight[0]
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):
"""
Miguel Valdez
r101 Selecciona un bloque de datos en base a canales segun el channelList
Victor Sarmiento
VoltageProcesor.py:...
r84
Input:
Victor Sarmiento
VoltageProcessor.py:...
r97 channelList : 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
Miguel Valdez
r99 self.dataOutObj.channelList
Victor Sarmiento
VoltageProcesor.py:...
r84 self.dataOutObj.nChannels
Miguel Valdez
r99 self.dataOutObj.m_ProcessingHeader.totalSpectra
Victor Sarmiento
VoltageProcesor.py:...
r84 self.dataOutObj.m_SystemHeader.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
for channel in channelList:
Miguel Valdez
r99 if channel not in self.dataOutObj.channelList:
Victor Sarmiento
VoltageProcessor.py:...
r97 raise ValueError, "The value %d in channelList is not valid" %channel
Victor Sarmiento
VoltageProcesor.py:...
r84
Miguel Valdez
r101 nChannels = len(channelList)
data = self.dataOutObj.data[channelList,:]
Miguel Valdez
r99 self.dataOutObj.data = data
self.dataOutObj.channelList = channelList
Miguel Valdez
r101 self.dataOutObj.nChannels = nChannels
self.dataOutObj.m_ProcessingHeader.totalSpectra = nChannels
self.dataOutObj.m_SystemHeader.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
self.dataOutObj.m_RadarControllerHeader
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
self.dataOutObj.m_RadarControllerHeader.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
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
def exe(self, data, ndata=None, type = 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
if type == 0:
self.convolutionInFreq(data,ndata)
if type == 1:
self.convolutionInTime(data, 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
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.data = numpy.fft.ifft(conv,axis=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):
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 conv[i,:] = numpy.correlate(data[i,:], newcode, 'same')
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)):
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):
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