##// END OF EJS Templates
7 de marzo 2018
7 de marzo 2018

File last commit:

r1148:fee9f80824df
r1148:fee9f80824df
Show More
jroproc_spectra.py
1067 lines | 36.2 KiB | text/x-python | PythonLexer
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 import numpy
from jroproc_base import ProcessingUnit, Operation
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 from schainpy.model.data.jrodata import Spectra
from schainpy.model.data.jrodata import hildebrand_sekhon
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
ebocanegra
23/11/2017
r1123 import matplotlib.pyplot as plt
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 class SpectraProc(ProcessingUnit):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
def __init__(self, **kwargs):
ProcessingUnit.__init__(self, **kwargs)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.buffer = None
self.firstdatatime = None
self.profIndex = 0
self.dataOut = Spectra()
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.id_min = None
self.id_max = None
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
jroproc_spectra module modified:...
r623 def __updateSpecFromVoltage(self):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.timeZone = self.dataIn.timeZone
self.dataOut.dstFlag = self.dataIn.dstFlag
self.dataOut.errorCount = self.dataIn.errorCount
self.dataOut.useLocalTime = self.dataIn.useLocalTime
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
self.dataOut.channelList = self.dataIn.channelList
self.dataOut.heightList = self.dataIn.heightList
self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')])
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.nBaud = self.dataIn.nBaud
self.dataOut.nCode = self.dataIn.nCode
self.dataOut.code = self.dataIn.code
self.dataOut.nProfiles = self.dataOut.nFFTPoints
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.dataOut.flagDiscontinuousBlock = self.dataIn.flagDiscontinuousBlock
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.utctime = self.firstdatatime
self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada
self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip
Miguel Valdez
jroproc_spectra module modified:...
r623 self.dataOut.flagShiftFFT = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.nCohInt = self.dataIn.nCohInt
self.dataOut.nIncohInt = 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.windowOfFilter = self.dataIn.windowOfFilter
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.frequency = self.dataIn.frequency
self.dataOut.realtime = self.dataIn.realtime
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
Filtering AMISR files for Datetime Range...
r499 self.dataOut.azimuth = self.dataIn.azimuth
self.dataOut.zenith = self.dataIn.zenith
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
ProfileToChannels this is a new Operation to get data with dimensions [nchannels,nsamples]
r501 self.dataOut.beam.codeList = self.dataIn.beam.codeList
self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList
self.dataOut.beam.zenithList = self.dataIn.beam.zenithList
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def __getFft(self):
"""
Convierte valores de Voltaje a Spectra
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Affected:
self.dataOut.data_spc
self.dataOut.data_cspc
self.dataOut.data_dc
self.dataOut.heightList
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 self.profIndex
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.buffer
self.dataOut.flagNoData
"""
fft_volt = numpy.fft.fft(self.buffer,n=self.dataOut.nFFTPoints,axis=1)
ebocanegra
Claire, Erick Bocanegra 21-02-18
r1146
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fft_volt = fft_volt.astype(numpy.dtype('complex'))
dc = fft_volt[:,0,:]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #calculo de self-spectra
fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,))
spc = fft_volt * numpy.conjugate(fft_volt)
spc = spc.real
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 blocksize = 0
blocksize += dc.size
blocksize += spc.size
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 cspc = None
pairIndex = 0
if self.dataOut.pairsList != None:
#calculo de cross-spectra
cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex')
for pair in self.dataOut.pairsList:
Miguel Valdez
Signal Chain GUI updated:...
r587 if pair[0] not in self.dataOut.channelList:
Miguel Valdez
Signal Chain GUI...
r600 raise ValueError, "Error getting CrossSpectra: pair 0 of %s is not in channelList = %s" %(str(pair), str(self.dataOut.channelList))
Miguel Valdez
Signal Chain GUI updated:...
r587 if pair[1] not in self.dataOut.channelList:
Miguel Valdez
Signal Chain GUI...
r600 raise ValueError, "Error getting CrossSpectra: pair 1 of %s is not in channelList = %s" %(str(pair), str(self.dataOut.channelList))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:])
pairIndex += 1
blocksize += cspc.size
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.data_spc = spc
self.dataOut.data_cspc = cspc
self.dataOut.data_dc = dc
self.dataOut.blockSize = blocksize
Miguel Valdez
jroproc_spectra module modified:...
r623 self.dataOut.flagShiftFFT = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def run(self, nProfiles=None, nFFTPoints=None, pairsList=[], ippFactor=None):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.flagNoData = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.dataIn.type == "Spectra":
self.dataOut.copy(self.dataIn)
Miguel Valdez
minor changes
r730 # self.__selectPairs(pairsList)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.dataIn.type == "Voltage":
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if nFFTPoints == None:
raise ValueError, "This SpectraProc.run() need nFFTPoints input variable"
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 if nProfiles == None:
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 nProfiles = nFFTPoints
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if ippFactor == None:
ippFactor = 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.ippFactor = ippFactor
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.nFFTPoints = nFFTPoints
self.dataOut.pairsList = pairsList
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495
Miguel Valdez
Bug fixed: Padding decode data with zeros at the first heights was eliminated.
r611 if self.buffer is None:
Miguel Valdez
jroproc_spectra module modified:...
r623 self.buffer = numpy.zeros( (self.dataIn.nChannels,
nProfiles,
self.dataIn.nHeights),
dtype='complex')
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
jroproc_spectra module modified:...
r623 if self.dataIn.flagDataAsBlock:
Miguel Valdez
Coherent Integration by Blocks: Bug fixed, nProfiles is divided by number of integrations
r720 #data dimension: [nChannels, nProfiles, nSamples]
ebocanegra
Claire, Erick Bocanegra 21-02-18
r1146
Miguel Valdez
Coherent Integration by Blocks: Bug fixed, nProfiles is divided by number of integrations
r720 nVoltProfiles = self.dataIn.data.shape[1]
Miguel Valdez
minor changes
r730 # nVoltProfiles = self.dataIn.nProfiles
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Coherent Integration by Blocks: Bug fixed, nProfiles is divided by number of integrations
r720 if nVoltProfiles == nProfiles:
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.buffer = self.dataIn.data.copy()
Miguel Valdez
Coherent Integration by Blocks: Bug fixed, nProfiles is divided by number of integrations
r720 self.profIndex = nVoltProfiles
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Coherent Integration by Blocks: Bug fixed, nProfiles is divided by number of integrations
r720 elif nVoltProfiles < nProfiles:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 if self.profIndex == 0:
self.id_min = 0
Miguel Valdez
Coherent Integration by Blocks: Bug fixed, nProfiles is divided by number of integrations
r720 self.id_max = nVoltProfiles
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.buffer[:,self.id_min:self.id_max,:] = self.dataIn.data
Miguel Valdez
Coherent Integration by Blocks: Bug fixed, nProfiles is divided by number of integrations
r720 self.profIndex += nVoltProfiles
self.id_min += nVoltProfiles
self.id_max += nVoltProfiles
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 else:
Miguel Valdez
minor changes
r750 raise ValueError, "The type object %s has %d profiles, it should just has %d profiles"%(self.dataIn.type,self.dataIn.data.shape[1],nProfiles)
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.dataOut.flagNoData = True
return 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 else:
ebocanegra
7 de marzo 2018
r1148
Miguel Valdez
jroproc_spectra module modified:...
r623 self.buffer[:,self.profIndex,:] = self.dataIn.data.copy()
self.profIndex += 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.firstdatatime == None:
self.firstdatatime = self.dataIn.utctime
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.profIndex == nProfiles:
Miguel Valdez
jroproc_spectra module modified:...
r623 self.__updateSpecFromVoltage()
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__getFft()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.flagNoData = False
self.firstdatatime = None
self.profIndex = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI updated:...
r587 raise ValueError, "The type of input object '%s' is not valid"%(self.dataIn.type)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 def __selectPairs(self, pairsList):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 if channelList == None:
return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 pairsIndexListSelected = []
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 for thisPair in pairsList:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 if thisPair not in self.dataOut.pairsList:
continue
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 pairIndex = self.dataOut.pairsList.index(thisPair)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 pairsIndexListSelected.append(pairIndex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 if not pairsIndexListSelected:
self.dataOut.data_cspc = None
self.dataOut.pairsList = []
return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 self.dataOut.data_cspc = self.dataOut.data_cspc[pairsIndexListSelected]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 self.dataOut.pairsList = [self.dataOut.pairsList[i] for i in pairsIndexListSelected]
Miguel Valdez
minor changes
r730 return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 def __selectPairsByChannel(self, channelList=None):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI updated:...
r587 if channelList == None:
return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI updated:...
r587 pairsIndexListSelected = []
for pairIndex in self.dataOut.pairsIndexList:
#First pair
if self.dataOut.pairsList[pairIndex][0] not in channelList:
continue
#Second pair
if self.dataOut.pairsList[pairIndex][1] not in channelList:
continue
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI updated:...
r587 pairsIndexListSelected.append(pairIndex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI updated:...
r587 if not pairsIndexListSelected:
self.dataOut.data_cspc = None
self.dataOut.pairsList = []
return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI updated:...
r587 self.dataOut.data_cspc = self.dataOut.data_cspc[pairsIndexListSelected]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 self.dataOut.pairsList = [self.dataOut.pairsList[i] for i in pairsIndexListSelected]
Miguel Valdez
Signal Chain GUI updated:...
r587 return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def selectChannels(self, channelList):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 channelIndexList = []
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for channel in channelList:
Miguel Valdez
Signal Chain GUI updated:...
r586 if channel not in self.dataOut.channelList:
Miguel Valdez
minor changes
r730 raise ValueError, "Error selecting channels, Channel %d is not valid.\nAvailable channels = %s" %(channel, str(self.dataOut.channelList))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 index = self.dataOut.channelList.index(channel)
channelIndexList.append(index)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.selectChannelsByIndex(channelIndexList)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def selectChannelsByIndex(self, channelIndexList):
"""
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 Selecciona un bloque de datos en base a canales segun el channelIndexList
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Input:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7]
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Affected:
self.dataOut.data_spc
self.dataOut.channelIndexList
self.dataOut.nChannels
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
None
"""
for channelIndex in channelIndexList:
if channelIndex not in self.dataOut.channelIndexList:
Miguel Valdez
Signal Chain GUI updated:...
r587 raise ValueError, "Error selecting channels: The value %d in channelIndexList is not valid.\nAvailable channel indexes = " %(channelIndex, self.dataOut.channelIndexList)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 # nChannels = len(channelIndexList)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 data_spc = self.dataOut.data_spc[channelIndexList,:]
Miguel Valdez
Signal Chain GUI updated:...
r587 data_dc = self.dataOut.data_dc[channelIndexList,:]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.data_spc = data_spc
Miguel Valdez
Signal Chain GUI updated:...
r587 self.dataOut.data_dc = data_dc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList]
# self.dataOut.nChannels = nChannels
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
minor changes
r730 self.__selectPairsByChannel(self.dataOut.channelList)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
ebocanegra
23/11/2017
r1123
def selectFFTs(self, minFFT, maxFFT ):
"""
Selecciona un bloque de datos en base a un grupo de valores de puntos FFTs segun el rango
minFFT<= FFT <= maxFFT
"""
if (minFFT > maxFFT):
raise ValueError, "Error selecting heights: Height range (%d,%d) is not valid" % (minFFT, maxFFT)
if (minFFT < self.dataOut.getFreqRange()[0]):
minFFT = self.dataOut.getFreqRange()[0]
if (maxFFT > self.dataOut.getFreqRange()[-1]):
maxFFT = self.dataOut.getFreqRange()[-1]
minIndex = 0
maxIndex = 0
FFTs = self.dataOut.getFreqRange()
inda = numpy.where(FFTs >= minFFT)
indb = numpy.where(FFTs <= maxFFT)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
ebocanegra
23/11/2017
r1123 try:
minIndex = inda[0][0]
except:
minIndex = 0
try:
maxIndex = indb[0][-1]
except:
maxIndex = len(FFTs)
self.selectFFTsByIndex(minIndex, maxIndex)
return 1
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def selectHeights(self, minHei, maxHei):
"""
Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango
minHei <= height <= maxHei
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Input:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 minHei : valor minimo de altura a considerar
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 maxHei : valor maximo de altura a considerar
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Affected:
Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
1 si el metodo se ejecuto con exito caso contrario devuelve 0
"""
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
ebocanegra
23/11/2017
r1123
Miguel Valdez
Signal Chain GUI updated:...
r587 if (minHei > maxHei):
raise ValueError, "Error selecting heights: Height range (%d,%d) is not valid" % (minHei, maxHei)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI updated:...
r587 if (minHei < self.dataOut.heightList[0]):
minHei = self.dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (maxHei > self.dataOut.heightList[-1]):
maxHei = self.dataOut.heightList[-1]
minIndex = 0
maxIndex = 0
heights = self.dataOut.heightList
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 inda = numpy.where(heights >= minHei)
indb = numpy.where(heights <= maxHei)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
minIndex = inda[0][0]
except:
minIndex = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
maxIndex = indb[0][-1]
except:
maxIndex = len(heights)
self.selectHeightsByIndex(minIndex, maxIndex)
ebocanegra
23/11/2017
r1123
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
def getBeaconSignal(self, tauindex = 0, channelindex = 0, hei_ref=None):
newheis = numpy.where(self.dataOut.heightList>self.dataOut.radarControllerHeaderObj.Taus[tauindex])
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if hei_ref != None:
newheis = numpy.where(self.dataOut.heightList>hei_ref)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 minIndex = min(newheis[0])
maxIndex = max(newheis[0])
data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1]
heightList = self.dataOut.heightList[minIndex:maxIndex+1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 # determina indices
nheis = int(self.dataOut.radarControllerHeaderObj.txB/(self.dataOut.heightList[1]-self.dataOut.heightList[0]))
avg_dB = 10*numpy.log10(numpy.sum(data_spc[channelindex,:,:],axis=0))
beacon_dB = numpy.sort(avg_dB)[-nheis:]
beacon_heiIndexList = []
for val in avg_dB.tolist():
if val >= beacon_dB[0]:
beacon_heiIndexList.append(avg_dB.tolist().index(val))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #data_spc = data_spc[:,:,beacon_heiIndexList]
data_cspc = None
Miguel Valdez
-Bug fixed: selecting channels and cross pairs...
r612 if self.dataOut.data_cspc is not None:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1]
#data_cspc = data_cspc[:,:,beacon_heiIndexList]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 data_dc = None
Miguel Valdez
-Bug fixed: selecting channels and cross pairs...
r612 if self.dataOut.data_dc is not None:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 data_dc = self.dataOut.data_dc[:,minIndex:maxIndex+1]
#data_dc = data_dc[:,beacon_heiIndexList]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.data_spc = data_spc
self.dataOut.data_cspc = data_cspc
self.dataOut.data_dc = data_dc
self.dataOut.heightList = heightList
self.dataOut.beacon_heiIndexList = beacon_heiIndexList
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
ebocanegra
23/11/2017
r1123 def selectFFTsByIndex(self, minIndex, maxIndex):
"""
"""
if (minIndex < 0) or (minIndex > maxIndex):
raise ValueError, "Error selecting heights: Index range (%d,%d) is not valid" % (minIndex, maxIndex)
if (maxIndex >= self.dataOut.nProfiles):
maxIndex = self.dataOut.nProfiles-1
#Spectra
data_spc = self.dataOut.data_spc[:,minIndex:maxIndex+1,:]
data_cspc = None
if self.dataOut.data_cspc is not None:
data_cspc = self.dataOut.data_cspc[:,minIndex:maxIndex+1,:]
data_dc = None
if self.dataOut.data_dc is not None:
data_dc = self.dataOut.data_dc[minIndex:maxIndex+1,:]
self.dataOut.data_spc = data_spc
self.dataOut.data_cspc = data_cspc
self.dataOut.data_dc = data_dc
self.dataOut.ippSeconds = self.dataOut.ippSeconds*(self.dataOut.nFFTPoints / numpy.shape(data_cspc)[1])
self.dataOut.nFFTPoints = numpy.shape(data_cspc)[1]
self.dataOut.profilesPerBlock = numpy.shape(data_cspc)[1]
#self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1]
return 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def selectHeightsByIndex(self, minIndex, maxIndex):
"""
Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango
minIndex <= index <= maxIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Input:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 minIndex : valor de indice minimo de altura a considerar
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 maxIndex : valor de indice maximo de altura a considerar
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Affected:
self.dataOut.data_spc
self.dataOut.data_cspc
self.dataOut.data_dc
self.dataOut.heightList
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
1 si el metodo se ejecuto con exito caso contrario devuelve 0
"""
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (minIndex < 0) or (minIndex > maxIndex):
Miguel Valdez
minor changes
r730 raise ValueError, "Error selecting heights: Index range (%d,%d) is not valid" % (minIndex, maxIndex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (maxIndex >= self.dataOut.nHeights):
maxIndex = self.dataOut.nHeights-1
#Spectra
data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 data_cspc = None
Miguel Valdez
-Bug fixed: selecting channels and cross pairs...
r612 if self.dataOut.data_cspc is not None:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 data_dc = None
Miguel Valdez
-Bug fixed: selecting channels and cross pairs...
r612 if self.dataOut.data_dc is not None:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 data_dc = self.dataOut.data_dc[:,minIndex:maxIndex+1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.data_spc = data_spc
self.dataOut.data_cspc = data_cspc
self.dataOut.data_dc = data_dc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
ebocanegra
23/11/2017
r1123
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def removeDC(self, mode = 2):
jspectra = self.dataOut.data_spc
jcspectra = self.dataOut.data_cspc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 num_chan = jspectra.shape[0]
num_hei = jspectra.shape[2]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
-Bug fixed: selecting channels and cross pairs...
r612 if jcspectra is not None:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 jcspectraExist = True
num_pairs = jcspectra.shape[0]
else: jcspectraExist = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 freq_dc = jspectra.shape[1]/2
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 ind_vel = numpy.array([-2,-1,1,2]) + freq_dc
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if ind_vel[0]<0:
ind_vel[range(0,1)] = ind_vel[range(0,1)] + self.num_prof
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
if mode == 1:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 jspectra[:,freq_dc,:] = (jspectra[:,ind_vel[1],:] + jspectra[:,ind_vel[2],:])/2 #CORRECCION
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if jcspectraExist:
jcspectra[:,freq_dc,:] = (jcspectra[:,ind_vel[1],:] + jcspectra[:,ind_vel[2],:])/2
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if mode == 2:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 vel = numpy.array([-2,-1,1,2])
xx = numpy.zeros([4,4])
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for fil in range(4):
xx[fil,:] = vel[fil]**numpy.asarray(range(4))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 xx_inv = numpy.linalg.inv(xx)
xx_aux = xx_inv[0,:]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for ich in range(num_chan):
yy = jspectra[ich,ind_vel,:]
jspectra[ich,freq_dc,:] = numpy.dot(xx_aux,yy)
junkid = jspectra[ich,freq_dc,:]<=0
cjunkid = sum(junkid)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if cjunkid.any():
jspectra[ich,freq_dc,junkid.nonzero()] = (jspectra[ich,ind_vel[1],junkid] + jspectra[ich,ind_vel[2],junkid])/2
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if jcspectraExist:
for ip in range(num_pairs):
yy = jcspectra[ip,ind_vel,:]
jcspectra[ip,freq_dc,:] = numpy.dot(xx_aux,yy)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.data_spc = jspectra
self.dataOut.data_cspc = jcspectra
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
ebocanegra
23/11/2017
r1123 def removeInterference2(self):
cspc = self.dataOut.data_cspc
spc = self.dataOut.data_spc
print numpy.shape(spc)
Heights = numpy.arange(cspc.shape[2])
realCspc = numpy.abs(cspc)
for i in range(cspc.shape[0]):
LinePower= numpy.sum(realCspc[i], axis=0)
Threshold = numpy.amax(LinePower)-numpy.sort(LinePower)[len(Heights)-int(len(Heights)*0.1)]
SelectedHeights = Heights[ numpy.where( LinePower < Threshold ) ]
#print numpy.shape(realCspc)
#print '',SelectedHeights, '', numpy.shape(realCspc[i,:,SelectedHeights])
InterferenceSum = numpy.sum( realCspc[i,:,SelectedHeights], axis=0 )
print SelectedHeights
InterferenceThresholdMin = numpy.sort(InterferenceSum)[int(len(InterferenceSum)*0.98)]
InterferenceThresholdMax = numpy.sort(InterferenceSum)[int(len(InterferenceSum)*0.99)]
InterferenceRange = numpy.where( ([InterferenceSum > InterferenceThresholdMin]))# , InterferenceSum < InterferenceThresholdMax]) )
#InterferenceRange = numpy.where( ([InterferenceRange < InterferenceThresholdMax]))
if len(InterferenceRange)<int(cspc.shape[1]*0.3):
cspc[i,InterferenceRange,:] = numpy.NaN
print '########################################################################################'
print 'Len interference sum',len(InterferenceSum)
print 'InterferenceThresholdMin', InterferenceThresholdMin, 'InterferenceThresholdMax', InterferenceThresholdMax
print 'InterferenceRange',InterferenceRange
print '########################################################################################'
''' Ploteo '''
#for i in range(3):
#print 'FASE', numpy.shape(phase), y[25]
#print numpy.shape(coherence)
#fig = plt.figure(10+ int(numpy.random.rand()*100))
#plt.plot( x[0:256],coherence[:,25] )
#cohAv = numpy.average(coherence[i],1)
#Pendiente = FrecRange * PhaseSlope[i]
#plt.plot( InterferenceSum)
#plt.plot( numpy.sort(InterferenceSum))
#plt.plot( LinePower )
#plt.plot( xFrec,phase[i])
#CSPCmean = numpy.mean(numpy.abs(CSPCSamples),0)
#plt.plot(xFrec, FitGauss01)
#plt.plot(xFrec, CSPCmean)
#plt.plot(xFrec, numpy.abs(CSPCSamples[0]))
#plt.plot(xFrec, FitGauss)
#plt.plot(xFrec, yMean)
#plt.plot(xFrec, numpy.abs(coherence[0]))
#plt.axis([-12, 12, 15, 50])
#plt.title("%s" %( '%s %s, Channel %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S") , i)))
#fig.savefig('/home/erick/Documents/Pics/nom{}.png'.format(int(numpy.random.rand()*100)))
#plt.show()
#self.indice=self.indice+1
#raise
self.dataOut.data_cspc = cspc
# for i in range(spc.shape[0]):
# LinePower= numpy.sum(spc[i], axis=0)
# Threshold = numpy.amax(LinePower)-numpy.sort(LinePower)[len(Heights)-int(len(Heights)*0.1)]
# SelectedHeights = Heights[ numpy.where( LinePower < Threshold ) ]
# #print numpy.shape(realCspc)
# #print '',SelectedHeights, '', numpy.shape(realCspc[i,:,SelectedHeights])
# InterferenceSum = numpy.sum( spc[i,:,SelectedHeights], axis=0 )
# InterferenceThreshold = numpy.sort(InterferenceSum)[int(len(InterferenceSum)*0.98)]
# InterferenceRange = numpy.where( InterferenceSum > InterferenceThreshold )
# if len(InterferenceRange)<int(spc.shape[1]*0.03):
# spc[i,InterferenceRange,:] = numpy.NaN
#self.dataOut.data_spc = spc
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def removeInterference(self, interf = 2,hei_interf = None, nhei_interf = None, offhei_interf = None):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 jspectra = self.dataOut.data_spc
jcspectra = self.dataOut.data_cspc
jnoise = self.dataOut.getNoise()
num_incoh = self.dataOut.nIncohInt
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 num_channel = jspectra.shape[0]
num_prof = jspectra.shape[1]
num_hei = jspectra.shape[2]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #hei_interf
Miguel Valdez
-Bug fixed: selecting channels and cross pairs...
r612 if hei_interf is None:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 count_hei = num_hei/2 #Como es entero no importa
hei_interf = numpy.asmatrix(range(count_hei)) + num_hei - count_hei
hei_interf = numpy.asarray(hei_interf)[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #nhei_interf
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (nhei_interf == None):
nhei_interf = 5
if (nhei_interf < 1):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 nhei_interf = 1
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (nhei_interf > count_hei):
nhei_interf = count_hei
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 if (offhei_interf == None):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 offhei_interf = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ind_hei = range(num_hei)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 # mask_prof = numpy.asarray(range(num_prof - 2)) + 1
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 # mask_prof[range(num_prof/2 - 1,len(mask_prof))] += 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 mask_prof = numpy.asarray(range(num_prof))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 num_mask_prof = mask_prof.size
comp_mask_prof = [0, num_prof/2]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #noise_exist: Determina si la variable jnoise ha sido definida y contiene la informacion del ruido de cada canal
if (jnoise.size < num_channel or numpy.isnan(jnoise).any()):
jnoise = numpy.nan
noise_exist = jnoise[0] < numpy.Inf
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #Subrutina de Remocion de la Interferencia
for ich in range(num_channel):
#Se ordena los espectros segun su potencia (menor a mayor)
power = jspectra[ich,mask_prof,:]
power = power[:,hei_interf]
power = power.sum(axis = 0)
psort = power.ravel().argsort()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #Se estima la interferencia promedio en los Espectros de Potencia empleando
junkspc_interf = jspectra[ich,:,hei_interf[psort[range(offhei_interf, nhei_interf + offhei_interf)]]]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if noise_exist:
# tmp_noise = jnoise[ich] / num_prof
tmp_noise = jnoise[ich]
junkspc_interf = junkspc_interf - tmp_noise
#junkspc_interf[:,comp_mask_prof] = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 jspc_interf = junkspc_interf.sum(axis = 0) / nhei_interf
jspc_interf = jspc_interf.transpose()
#Calculando el espectro de interferencia promedio
Ivan Valdez
jroproc_spectra.py: math module is not used anymore
r722 noiseid = numpy.where(jspc_interf <= tmp_noise/ numpy.sqrt(num_incoh))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 noiseid = noiseid[0]
cnoiseid = noiseid.size
Ivan Valdez
jroproc_spectra.py: math module is not used anymore
r722 interfid = numpy.where(jspc_interf > tmp_noise/ numpy.sqrt(num_incoh))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 interfid = interfid[0]
cinterfid = interfid.size
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (cnoiseid > 0): jspc_interf[noiseid] = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #Expandiendo los perfiles a limpiar
if (cinterfid > 0):
new_interfid = (numpy.r_[interfid - 1, interfid, interfid + 1] + num_prof)%num_prof
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 new_interfid = numpy.asarray(new_interfid)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 new_interfid = {x for x in new_interfid}
new_interfid = numpy.array(list(new_interfid))
new_cinterfid = new_interfid.size
else: new_cinterfid = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for ip in range(new_cinterfid):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 ind = junkspc_interf[:,new_interfid[ip]].ravel().argsort()
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 jspc_interf[new_interfid[ip]] = junkspc_interf[ind[nhei_interf/2],new_interfid[ip]]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 jspectra[ich,:,ind_hei] = jspectra[ich,:,ind_hei] - jspc_interf #Corregir indices
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #Removiendo la interferencia del punto de mayor interferencia
ListAux = jspc_interf[mask_prof].tolist()
maxid = ListAux.index(max(ListAux))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if cinterfid > 0:
for ip in range(cinterfid*(interf == 2) - 1):
Ivan Valdez
jroproc_spectra.py: math module is not used anymore
r722 ind = (jspectra[ich,interfid[ip],:] < tmp_noise*(1 + 1/numpy.sqrt(num_incoh))).nonzero()
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 cind = len(ind)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (cind > 0):
Ivan Valdez
jroproc_spectra.py: math module is not used anymore
r722 jspectra[ich,interfid[ip],ind] = tmp_noise*(1 + (numpy.random.uniform(cind) - 0.5)/numpy.sqrt(num_incoh))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ind = numpy.array([-2,-1,1,2])
xx = numpy.zeros([4,4])
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for id1 in range(4):
xx[:,id1] = ind[id1]**numpy.asarray(range(4))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 xx_inv = numpy.linalg.inv(xx)
xx = xx_inv[:,0]
ind = (ind + maxid + num_mask_prof)%num_mask_prof
yy = jspectra[ich,mask_prof[ind],:]
jspectra[ich,mask_prof[maxid],:] = numpy.dot(yy.transpose(),xx)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
indAux = (jspectra[ich,:,:] < tmp_noise*(1-1/numpy.sqrt(num_incoh))).nonzero()
Ivan Valdez
jroproc_spectra.py: math module is not used anymore
r722 jspectra[ich,indAux[0],indAux[1]] = tmp_noise * (1 - 1/numpy.sqrt(num_incoh))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #Remocion de Interferencia en el Cross Spectra
Miguel Valdez
-Bug fixed: selecting channels and cross pairs...
r612 if jcspectra is None: return jspectra, jcspectra
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 num_pairs = jcspectra.size/(num_prof*num_hei)
jcspectra = jcspectra.reshape(num_pairs, num_prof, num_hei)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for ip in range(num_pairs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #-------------------------------------------
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 cspower = numpy.abs(jcspectra[ip,mask_prof,:])
cspower = cspower[:,hei_interf]
cspower = cspower.sum(axis = 0)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 cspsort = cspower.ravel().argsort()
junkcspc_interf = jcspectra[ip,:,hei_interf[cspsort[range(offhei_interf, nhei_interf + offhei_interf)]]]
junkcspc_interf = junkcspc_interf.transpose()
jcspc_interf = junkcspc_interf.sum(axis = 1)/nhei_interf
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ind = numpy.abs(jcspc_interf[mask_prof]).ravel().argsort()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 median_real = numpy.median(numpy.real(junkcspc_interf[mask_prof[ind[range(3*num_prof/4)]],:]))
median_imag = numpy.median(numpy.imag(junkcspc_interf[mask_prof[ind[range(3*num_prof/4)]],:]))
junkcspc_interf[comp_mask_prof,:] = numpy.complex(median_real, median_imag)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for iprof in range(num_prof):
ind = numpy.abs(junkcspc_interf[iprof,:]).ravel().argsort()
jcspc_interf[iprof] = junkcspc_interf[iprof, ind[nhei_interf/2]]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #Removiendo la Interferencia
jcspectra[ip,:,ind_hei] = jcspectra[ip,:,ind_hei] - jcspc_interf
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ListAux = numpy.abs(jcspc_interf[mask_prof]).tolist()
maxid = ListAux.index(max(ListAux))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ind = numpy.array([-2,-1,1,2])
xx = numpy.zeros([4,4])
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for id1 in range(4):
xx[:,id1] = ind[id1]**numpy.asarray(range(4))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 xx_inv = numpy.linalg.inv(xx)
xx = xx_inv[:,0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ind = (ind + maxid + num_mask_prof)%num_mask_prof
yy = jcspectra[ip,mask_prof[ind],:]
jcspectra[ip,mask_prof[maxid],:] = numpy.dot(yy.transpose(),xx)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #Guardar Resultados
self.dataOut.data_spc = jspectra
self.dataOut.data_cspc = jcspectra
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def setRadarFrequency(self, frequency=None):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if frequency != None:
self.dataOut.frequency = frequency
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
def getNoise(self, minHei=None, maxHei=None, minVel=None, maxVel=None):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #validacion de rango
if minHei == None:
minHei = self.dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if maxHei == None:
maxHei = self.dataOut.heightList[-1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei):
print 'minHei: %.2f is out of the heights range'%(minHei)
print 'minHei is setting to %.2f'%(self.dataOut.heightList[0])
minHei = self.dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (maxHei > self.dataOut.heightList[-1]) or (maxHei < minHei):
print 'maxHei: %.2f is out of the heights range'%(maxHei)
print 'maxHei is setting to %.2f'%(self.dataOut.heightList[-1])
maxHei = self.dataOut.heightList[-1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 # validacion de velocidades
velrange = self.dataOut.getVelRange(1)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if minVel == None:
minVel = velrange[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if maxVel == None:
maxVel = velrange[-1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (minVel < velrange[0]) or (minVel > maxVel):
print 'minVel: %.2f is out of the velocity range'%(minVel)
print 'minVel is setting to %.2f'%(velrange[0])
minVel = velrange[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (maxVel > velrange[-1]) or (maxVel < minVel):
print 'maxVel: %.2f is out of the velocity range'%(maxVel)
print 'maxVel is setting to %.2f'%(velrange[-1])
maxVel = velrange[-1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
# seleccion de indices para rango
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 minIndex = 0
maxIndex = 0
heights = self.dataOut.heightList
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 inda = numpy.where(heights >= minHei)
indb = numpy.where(heights <= maxHei)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
minIndex = inda[0][0]
except:
minIndex = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
maxIndex = indb[0][-1]
except:
maxIndex = len(heights)
if (minIndex < 0) or (minIndex > maxIndex):
raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (maxIndex >= self.dataOut.nHeights):
maxIndex = self.dataOut.nHeights-1
# seleccion de indices para velocidades
indminvel = numpy.where(velrange >= minVel)
indmaxvel = numpy.where(velrange <= maxVel)
try:
minIndexVel = indminvel[0][0]
except:
minIndexVel = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
maxIndexVel = indmaxvel[0][-1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 except:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 maxIndexVel = len(velrange)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #seleccion del espectro
data_spc = self.dataOut.data_spc[:,minIndexVel:maxIndexVel+1,minIndex:maxIndex+1]
#estimacion de ruido
noise = numpy.zeros(self.dataOut.nChannels)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for channel in range(self.dataOut.nChannels):
daux = data_spc[channel,:,:]
noise[channel] = hildebrand_sekhon(daux, self.dataOut.nIncohInt)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.noise_estimation = noise.copy()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 class IncohInt(Operation):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 __profIndex = 0
__withOverapping = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 __byTime = False
__initime = None
__lastdatatime = None
__integrationtime = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 __buffer_spc = None
__buffer_cspc = None
__buffer_dc = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 __dataReady = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 __timeInterval = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 n = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 # self.isConfig = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def setup(self, n=None, timeInterval=None, overlapping=False):
"""
Set the parameters of the integration class.
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Inputs:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 n : Number of coherent integrations
timeInterval : Time of integration. If the parameter "n" is selected this one does not work
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 overlapping :
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__initime = None
self.__lastdatatime = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 self.__buffer_spc = 0
self.__buffer_cspc = 0
self.__buffer_dc = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 self.__profIndex = 0
self.__dataReady = False
self.__byTime = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 if n is None and timeInterval is None:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 raise ValueError, "n or timeInterval should be specified ..."
Miguel Valdez
jroproc_spectra module modified:...
r623 if n is not None:
self.n = int(n)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
Miguel Valdez
jroproc_spectra module modified:...
r623 self.__integrationtime = int(timeInterval) #if (type(timeInterval)!=integer) -> change this line
self.n = None
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__byTime = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def putData(self, data_spc, data_cspc, data_dc):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
Add a profile to the __buffer_spc and increase in one the __profileIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 self.__buffer_spc += data_spc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 if data_cspc is None:
self.__buffer_cspc = None
else:
self.__buffer_cspc += data_cspc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 if data_dc is None:
self.__buffer_dc = None
else:
self.__buffer_dc += data_dc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 self.__profIndex += 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def pushData(self):
"""
Return the sum of the last profiles and the profiles used in the sum.
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Affected:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__profileIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 data_spc = self.__buffer_spc
data_cspc = self.__buffer_cspc
data_dc = self.__buffer_dc
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 n = self.__profIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 self.__buffer_spc = 0
self.__buffer_cspc = 0
self.__buffer_dc = 0
self.__profIndex = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return data_spc, data_cspc, data_dc, n
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def byProfiles(self, *args):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__dataReady = False
Miguel Valdez
Bug fixed:...
r624 avgdata_spc = None
avgdata_cspc = None
avgdata_dc = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.putData(*args)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.__profIndex == self.n:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData()
Miguel Valdez
jroproc_spectra module modified:...
r623 self.n = n
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__dataReady = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return avgdata_spc, avgdata_cspc, avgdata_dc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def byTime(self, datatime, *args):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__dataReady = False
Miguel Valdez
Bug fixed:...
r624 avgdata_spc = None
avgdata_cspc = None
avgdata_dc = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.putData(*args)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (datatime - self.__initime) >= self.__integrationtime:
avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData()
self.n = n
self.__dataReady = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return avgdata_spc, avgdata_cspc, avgdata_dc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def integrate(self, datatime, *args):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 if self.__profIndex == 0:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__initime = datatime
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.__byTime:
avgdata_spc, avgdata_cspc, avgdata_dc = self.byTime(datatime, *args)
else:
avgdata_spc, avgdata_cspc, avgdata_dc = self.byProfiles(*args)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 if not self.__dataReady:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return None, None, None, None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 return self.__initime, avgdata_spc, avgdata_cspc, avgdata_dc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def run(self, dataOut, n=None, timeInterval=None, overlapping=False):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if n==1:
return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_spectra module modified:...
r623 dataOut.flagNoData = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not self.isConfig:
self.setup(n, timeInterval, overlapping)
self.isConfig = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc = self.integrate(dataOut.utctime,
dataOut.data_spc,
dataOut.data_cspc,
dataOut.data_dc)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.__dataReady:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 dataOut.data_spc = avgdata_spc
dataOut.data_cspc = avgdata_cspc
dataOut.data_dc = avgdata_dc
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 dataOut.nIncohInt *= self.n
dataOut.utctime = avgdatatime
dataOut.flagNoData = False
ebocanegra
15/08/2017
r1001