##// END OF EJS Templates
changes from v4
changes from v4

File last commit:

r1660:e4ab06acc1bd
r1664:a9d92c6e95c5
Show More
jroproc_voltage.py
3089 lines | 105.1 KiB | text/x-python | PythonLexer
Ivan Valdez
Bug fixed: importing sys module
r723 import sys
update for weather radar options
r1296 import numpy,math
Julio Valdez
jroproc_voltage.py: Interpolate heights operation fixed
r837 from scipy import interpolate
Juan C. Espinoza
fix typo :(
r1178 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 from schainpy.model.data.jrodata import Voltage,hildebrand_sekhon
George Yong
Python 2to3, Voltage (all operations) working
r1168 from schainpy.utils import log
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 from schainpy.model.io.utilsIO import getHei_index
George Yong
Multiprocessing for voltage (all operations) working
r1173 from time import time
proc schain amisr isr1
r1547 import datetime
AMISR correcciones, procesamientos
r1417 import numpy
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #import copy
from schainpy.model.data import _noise
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287
Rem Yagi profiles from amisr data
r1590 from matplotlib import pyplot as plt
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279 class VoltageProc(ProcessingUnit):
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177 def __init__(self):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177 ProcessingUnit.__init__(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 = Voltage()
self.flip = 1
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177 self.setupReq = False
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):
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 #print("running volt proc")
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
Daniel Valdez
AMISR modules to read hdf5 files and link to SignalChain Objects...
r491 if self.dataIn.type == 'AMISR':
self.__updateObjFromAmisrInput()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 if self.dataOut.buffer_empty:
if self.dataIn.type == 'Voltage':
self.dataOut.copy(self.dataIn)
updates real multiprocess, save hdf5, utils_Io
r1559 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
self.dataOut.ippSeconds = self.dataIn.ippSeconds
self.dataOut.ipp = self.dataIn.ipp
#update Processing Header:
self.dataOut.processingHeaderObj.heightList = self.dataOut.heightList
self.dataOut.processingHeaderObj.ipp = self.dataOut.ipp
self.dataOut.processingHeaderObj.nCohInt = self.dataOut.nCohInt
self.dataOut.processingHeaderObj.dtype = self.dataOut.type
self.dataOut.processingHeaderObj.channelList = self.dataOut.channelList
self.dataOut.processingHeaderObj.azimuthList = self.dataOut.azimuthList
self.dataOut.processingHeaderObj.elevationList = self.dataOut.elevationList
self.dataOut.processingHeaderObj.codeList = self.dataOut.nChannels
self.dataOut.processingHeaderObj.heightList = self.dataOut.heightList
self.dataOut.processingHeaderObj.heightResolution = self.dataOut.heightList[1] - self.dataOut.heightList[0]
Interference from YAGI removed, remHeightsIppInterf added
r1579
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
AMISR modules to read hdf5 files and link to SignalChain Objects...
r491 def __updateObjFromAmisrInput(self):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
AMISR modules to read hdf5 files and link to SignalChain Objects...
r491 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
AMISR modules to read hdf5 files and link to SignalChain Objects...
r491 self.dataOut.flagNoData = self.dataIn.flagNoData
self.dataOut.data = self.dataIn.data
self.dataOut.utctime = self.dataIn.utctime
self.dataOut.channelList = self.dataIn.channelList
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 #self.dataOut.timeInterval = self.dataIn.timeInterval
Daniel Valdez
AMISR modules to read hdf5 files and link to SignalChain Objects...
r491 self.dataOut.heightList = self.dataIn.heightList
self.dataOut.nProfiles = self.dataIn.nProfiles
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Daniel Valdez
AMISR modules to read hdf5 files and link to SignalChain Objects...
r491 self.dataOut.nCohInt = self.dataIn.nCohInt
self.dataOut.ippSeconds = self.dataIn.ippSeconds
self.dataOut.frequency = self.dataIn.frequency
updates real multiprocess, save hdf5, utils_Io
r1559
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
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 class selectChannels(Operation):
update for weather radar options
r1296
cambios sendtoServer, lectura spectra desde Hdf5
r1406 def run(self, dataOut, channelList=None):
self.channelList = channelList
if self.channelList == None:
print("Missing channelList")
return dataOut
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 = []
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 if not dataOut.buffer_empty: # cuando se usa proc volts como buffer de datos
return dataOut
#print("channel List: ", dataOut.channelList)
AMISR correcciones, procesamientos
r1417 if type(dataOut.channelList) is not list: #leer array desde HDF5
try:
dataOut.channelList = dataOut.channelList.tolist()
except Exception as e:
print("Select Channels: ",e)
cambios sendtoServer, lectura spectra desde Hdf5
r1406 for channel in self.channelList:
if channel not in dataOut.channelList:
raise ValueError("Channel %d is not in %s" %(channel, str(dataOut.channelList)))
index = dataOut.channelList.index(channel)
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.append(index)
cambios sendtoServer, lectura spectra desde Hdf5
r1406 dataOut = self.selectChannelsByIndex(dataOut,channelIndexList)
updates real multiprocess, save hdf5, utils_Io
r1559
#update Processing Header:
dataOut.processingHeaderObj.channelList = dataOut.channelList
dataOut.processingHeaderObj.elevationList = dataOut.elevationList
dataOut.processingHeaderObj.azimuthList = dataOut.azimuthList
dataOut.processingHeaderObj.codeList = dataOut.codeList
dataOut.processingHeaderObj.nChannels = len(dataOut.channelList)
cambios sendtoServer, lectura spectra desde Hdf5
r1406 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
cambios sendtoServer, lectura spectra desde Hdf5
r1406 def selectChannelsByIndex(self, dataOut, 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 """
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:
cambios sendtoServer, lectura spectra desde Hdf5
r1406 dataOut.data
dataOut.channelIndexList
dataOut.nChannels
dataOut.m_ProcessingHeader.totalSpectra
dataOut.systemHeaderObj.numChannels
dataOut.m_ProcessingHeader.blockSize
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
"""
AMISR correcciones, procesamientos
r1417 #print("selectChannelsByIndex")
cambios sendtoServer, lectura spectra desde Hdf5
r1406 # for channelIndex in channelIndexList:
# if channelIndex not in dataOut.channelIndexList:
# raise ValueError("The value %d in channelIndexList is not valid" %channelIndex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
cambios sendtoServer, lectura spectra desde Hdf5
r1406 if dataOut.type == 'Voltage':
if dataOut.flagDataAsBlock:
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 """
Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis]
"""
cambios sendtoServer, lectura spectra desde Hdf5
r1406 data = dataOut.data[channelIndexList,:,:]
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 else:
cambios sendtoServer, lectura spectra desde Hdf5
r1406 data = dataOut.data[channelIndexList,:]
dataOut.data = data
# dataOut.channelList = [dataOut.channelList[i] for i in channelIndexList]
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 dataOut.channelList = [n for n in range(len(channelIndexList))]
cambios sendtoServer, lectura spectra desde Hdf5
r1406
elif dataOut.type == 'Spectra':
AMISR correcciones, procesamientos
r1417 if hasattr(dataOut, 'data_spc'):
if dataOut.data_spc is None:
raise ValueError("data_spc is None")
return dataOut
else:
data_spc = dataOut.data_spc[channelIndexList, :]
dataOut.data_spc = data_spc
# if hasattr(dataOut, 'data_dc') :# and
# if dataOut.data_dc is None:
# raise ValueError("data_dc is None")
# return dataOut
# else:
# data_dc = dataOut.data_dc[channelIndexList, :]
# dataOut.data_dc = data_dc
cambios sendtoServer, lectura spectra desde Hdf5
r1406 # dataOut.channelList = [dataOut.channelList[i] for i in channelIndexList]
dataOut.channelList = channelIndexList
dataOut = self.__selectPairsByChannel(dataOut,channelIndexList)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 if len(dataOut.elevationList>0):
dataOut.elevationList = dataOut.elevationList[channelIndexList]
dataOut.azimuthList = dataOut.azimuthList[channelIndexList]
dataOut.codeList = dataOut.codeList[channelIndexList]
cambios sendtoServer, lectura spectra desde Hdf5
r1406 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
cambios sendtoServer, lectura spectra desde Hdf5
r1406 def __selectPairsByChannel(self, dataOut, channelList=None):
AMISR correcciones, procesamientos
r1417 #print("__selectPairsByChannel")
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if channelList == None:
return
pairsIndexListSelected = []
cambios sendtoServer, lectura spectra desde Hdf5
r1406 for pairIndex in dataOut.pairsIndexList:
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 # First pair
cambios sendtoServer, lectura spectra desde Hdf5
r1406 if dataOut.pairsList[pairIndex][0] not in channelList:
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 continue
# Second pair
cambios sendtoServer, lectura spectra desde Hdf5
r1406 if dataOut.pairsList[pairIndex][1] not in channelList:
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 continue
pairsIndexListSelected.append(pairIndex)
if not pairsIndexListSelected:
cambios sendtoServer, lectura spectra desde Hdf5
r1406 dataOut.data_cspc = None
dataOut.pairsList = []
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 return
cambios sendtoServer, lectura spectra desde Hdf5
r1406 dataOut.data_cspc = dataOut.data_cspc[pairsIndexListSelected]
dataOut.pairsList = [dataOut.pairsList[i]
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 for i in pairsIndexListSelected]
cambios sendtoServer, lectura spectra desde Hdf5
r1406 return dataOut
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287
class selectHeights(Operation):
update for weather radar options
r1296
Beta 6, add dopplerFlip operation, fix selectHeights
r1344 def run(self, dataOut, minHei=None, maxHei=None, minIndex=None, maxIndex=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 """
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
cambios para amisr ISR
r1465 self.dataOut = dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Beta 6, add dopplerFlip operation, fix selectHeights
r1344 if minHei and maxHei:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
cambios sendtoServer, lectura spectra desde Hdf5
r1406 if (minHei < dataOut.heightList[0]):
minHei = dataOut.heightList[0]
Miguel Valdez
-Using ValueError raises instead of IOError...
r684
cambios sendtoServer, lectura spectra desde Hdf5
r1406 if (maxHei > dataOut.heightList[-1]):
maxHei = dataOut.heightList[-1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Beta 6, add dopplerFlip operation, fix selectHeights
r1344 minIndex = 0
maxIndex = 0
cambios sendtoServer, lectura spectra desde Hdf5
r1406 heights = dataOut.heightList
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Beta 6, add dopplerFlip operation, fix selectHeights
r1344 inda = numpy.where(heights >= minHei)
indb = numpy.where(heights <= maxHei)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Beta 6, add dopplerFlip operation, fix selectHeights
r1344 try:
minIndex = inda[0][0]
except:
minIndex = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Beta 6, add dopplerFlip operation, fix selectHeights
r1344 try:
maxIndex = indb[0][-1]
except:
maxIndex = len(heights)
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.selectHeightsByIndex(minIndex, maxIndex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
updates real multiprocess, save hdf5, utils_Io
r1559 #update Processing Header:
dataOut.processingHeaderObj.heightList = dataOut.heightList
cambios para amisr ISR
r1465 return dataOut
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
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
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if self.dataOut.type == 'Voltage':
if (minIndex < 0) or (minIndex > maxIndex):
raise ValueError("Height index range (%d,%d) is not valid" % (minIndex, maxIndex))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if (maxIndex >= self.dataOut.nHeights):
maxIndex = self.dataOut.nHeights
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 #voltage
if self.dataOut.flagDataAsBlock:
"""
Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis]
"""
data = self.dataOut.data[:,:, minIndex:maxIndex]
else:
data = self.dataOut.data[:, minIndex:maxIndex]
# firstHeight = self.dataOut.heightList[minIndex]
self.dataOut.data = data
self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex]
if self.dataOut.nHeights <= 1:
raise ValueError("selectHeights: Too few heights. Current number of heights is %d" %(self.dataOut.nHeights))
elif self.dataOut.type == 'Spectra':
if (minIndex < 0) or (minIndex > maxIndex):
raise ValueError("Error selecting heights: Index range (%d,%d) is not valid" % (
minIndex, maxIndex))
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
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if (maxIndex >= self.dataOut.nHeights):
maxIndex = self.dataOut.nHeights - 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
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 # Spectra
data_spc = self.dataOut.data_spc[:, :, minIndex:maxIndex + 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
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 data_cspc = None
if self.dataOut.data_cspc is not None:
data_cspc = self.dataOut.data_cspc[:, :, minIndex:maxIndex + 1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 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.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
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 class filterByHeights(Operation):
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 ifConfig=False
deltaHeight = None
newdelta=None
newheights=None
r=None
h0=None
nHeights=None
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 def run(self, dataOut, window):
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655
# print("1",dataOut.data.shape)
# print(dataOut.nHeights)
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 window == None:
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 window = (dataOut.radarControllerHeaderObj.txA/dataOut.radarControllerHeaderObj.nBaud) / self.deltaHeight
if not self.ifConfig: #and dataOut.useInputBuffer:
self.deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
self.ifConfig = True
self.newdelta = self.deltaHeight * window
self.r = dataOut.nHeights % window
self.newheights = (dataOut.nHeights-self.r)/window
self.h0 = dataOut.heightList[0]
self.nHeights = dataOut.nHeights
if self.newheights <= 1:
raise ValueError("filterByHeights: Too few heights. Current number of heights is %d and window is %d" %(dataOut.nHeights, window))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if dataOut.flagDataAsBlock:
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 """
Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis]
"""
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 buffer = dataOut.data[:, :, 0:int(self.nHeights-self.r)]
buffer = buffer.reshape(dataOut.nChannels, dataOut.nProfiles, int(self.nHeights/window), window)
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 buffer = numpy.sum(buffer,3)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 else:
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 buffer = dataOut.data[:,0:int(self.nHeights-self.r)]
buffer = buffer.reshape(dataOut.nChannels,int(self.nHeights/window),int(window))
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 buffer = numpy.sum(buffer,2)
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 dataOut.data = buffer
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 dataOut.heightList = self.h0 + numpy.arange( self.newheights )*self.newdelta
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 dataOut.windowOfFilter = window
updates real multiprocess, save hdf5, utils_Io
r1559 #update Processing Header:
dataOut.processingHeaderObj.heightList = dataOut.heightList
dataOut.processingHeaderObj.nWindows = window
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 return dataOut
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 class setH0(Operation):
def run(self, dataOut, h0, deltaHeight = None):
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 if not deltaHeight:
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 nHeights = dataOut.nHeights
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 newHeiRange = h0 + numpy.arange(nHeights)*deltaHeight
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 dataOut.heightList = newHeiRange
updates real multiprocess, save hdf5, utils_Io
r1559 #update Processing Header:
dataOut.processingHeaderObj.heightList = dataOut.heightList
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 class deFlip(Operation):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 def run(self, dataOut, channelList = []):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 data = dataOut.data.copy()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if dataOut.flagDataAsBlock:
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 flip = self.flip
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 profileList = list(range(dataOut.nProfiles))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI updated:...
r587 if not channelList:
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 for thisProfile in profileList:
data[:,thisProfile,:] = data[:,thisProfile,:]*flip
flip *= -1.0
else:
for thisChannel in channelList:
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if thisChannel not in dataOut.channelList:
Miguel Valdez
Signal Chain GUI updated:...
r586 continue
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 for thisProfile in profileList:
data[thisChannel,thisProfile,:] = data[thisChannel,thisProfile,:]*flip
flip *= -1.0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 self.flip = flip
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 else:
Miguel Valdez
Signal Chain GUI updated:...
r587 if not channelList:
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 data[:,:] = data[:,:]*self.flip
else:
for thisChannel in channelList:
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if thisChannel not in dataOut.channelList:
Miguel Valdez
Signal Chain GUI updated:...
r586 continue
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 data[thisChannel,:] = data[thisChannel,:]*self.flip
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 self.flip *= -1.
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 dataOut.data = data
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 class setAttribute(Operation):
'''
Juan C. Espinoza
New GUI added (kivy framework), clean code, delete unused files
r1288 Set an arbitrary attribute(s) to dataOut
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 '''
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 def __init__(self):
Operation.__init__(self)
self._ready = False
def run(self, dataOut, **kwargs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 for key, value in kwargs.items():
setattr(dataOut, key, value)
return dataOut
Juan C. Espinoza
Update plots modules
r1308 @MPDecorator
class printAttribute(Operation):
'''
Print an arbitrary attribute of dataOut
'''
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Update plots modules
r1308 def __init__(self):
Operation.__init__(self)
def run(self, dataOut, attributes):
Add metadata attribute to data types
r1338 if isinstance(attributes, str):
attributes = [attributes]
Juan C. Espinoza
Update plots modules
r1308 for attr in attributes:
if hasattr(dataOut, attr):
log.log(getattr(dataOut, attr), attr)
proc schain amisr isr1
r1547 class cleanHeightsInterf(Operation):
remSatsProfiles
r1548 __slots__ =('heights_indx', 'repeats', 'step', 'factor', 'idate', 'idxs','config','wMask')
def __init__(self):
self.repeats = 0
self.factor=1
self.wMask = None
self.config = False
self.idxs = None
self.heights_indx = None
proc schain amisr isr1
r1547
def run(self, dataOut, heightsList, repeats=0, step=0, factor=1, idate=None, startH=None, endH=None):
#print(dataOut.data.shape)
startTime = datetime.datetime.combine(idate,startH)
endTime = datetime.datetime.combine(idate,endH)
currentTime = datetime.datetime.fromtimestamp(dataOut.utctime)
if currentTime < startTime or currentTime > endTime:
return dataOut
remSatsProfiles
r1548 if not self.config:
#print(wMask)
heights = [float(hei) for hei in heightsList]
for r in range(repeats):
heights += [ (h+(step*(r+1))) for h in heights]
#print(heights)
heiList = dataOut.heightList
self.heights_indx = [getHei_index(h,h,heiList)[0] for h in heights]
self.wMask = numpy.asarray(factor)
self.wMask = numpy.tile(self.wMask,(repeats+2))
self.config = True
"""
getNoisebyHildebrand(self, channel=None, ymin_index=None, ymax_index=None)
"""
#print(self.noise =10*numpy.log10(dataOut.getNoisebyHildebrand(ymin_index=self.min_ref, ymax_index=self.max_ref)))
proc schain amisr isr1
r1547
for ch in range(dataOut.data.shape[0]):
i = 0
remSatsProfiles
r1548
for hei in self.heights_indx:
h = hei - 1
proc schain amisr isr1
r1547 if dataOut.data.ndim < 3:
remSatsProfiles
r1548 module = numpy.absolute(dataOut.data[ch,h])
prev_h1 = numpy.absolute(dataOut.data[ch,h-1])
dataOut.data[ch,h] = (dataOut.data[ch,h])/module * prev_h1
#dataOut.data[ch,hei-1] = (dataOut.data[ch,hei-1])*self.wMask[i]
proc schain amisr isr1
r1547 else:
remSatsProfiles
r1548 module = numpy.absolute(dataOut.data[ch,:,h])
prev_h1 = numpy.absolute(dataOut.data[ch,:,h-1])
dataOut.data[ch,:,h] = (dataOut.data[ch,:,h])/module * prev_h1
#dataOut.data[ch,:,hei-1] = (dataOut.data[ch,:,hei-1])*self.wMask[i]
proc schain amisr isr1
r1547 #print("done")
i += 1
remSatsProfiles
r1548
proc schain amisr isr1
r1547 return dataOut
Juan C. Espinoza
Update plots modules
r1308
remSatsProfiles
r1548
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 class interpolateHeights(Operation):
def run(self, dataOut, topLim, botLim):
Julio Valdez
-Function to interpolate corrupted profiles
r836 #69 al 72 para julia
#82-84 para meteoros
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 if len(numpy.shape(dataOut.data))==2:
sampInterp = (dataOut.data[:,botLim-1] + dataOut.data[:,topLim+1])/2
Julio Valdez
-Function to interpolate corrupted profiles
r836 sampInterp = numpy.transpose(numpy.tile(sampInterp,(topLim-botLim + 1,1)))
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 #dataOut.data[:,botLim:limSup+1] = sampInterp
dataOut.data[:,botLim:topLim+1] = sampInterp
Julio Valdez
-Function to interpolate corrupted profiles
r836 else:
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 nHeights = dataOut.data.shape[2]
Julio Valdez
jroproc_voltage.py: Interpolate heights operation fixed
r837 x = numpy.hstack((numpy.arange(botLim),numpy.arange(topLim+1,nHeights)))
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 y = dataOut.data[:,:,list(range(botLim))+list(range(topLim+1,nHeights))]
Julio Valdez
jroproc_voltage.py: Interpolate heights operation fixed
r837 f = interpolate.interp1d(x, y, axis = 2)
xnew = numpy.arange(botLim,topLim+1)
ynew = f(xnew)
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 dataOut.data[:,:,botLim:topLim+1] = ynew
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Rewrite controller, remove MPDecorator to units (keep for plots an writers) use of queues for interproc comm instead of zmq, self operations are no longer supported
r1287 return dataOut
Julio Valdez
jroproc_voltage.py: Interpolate heights operation fixed
r837
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177
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 CohInt(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 isConfig = False
__profIndex = 0
__byTime = False
__initime = None
__lastdatatime = None
__integrationtime = None
__buffer = None
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 __bufferStride = []
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
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 __profIndexStride = 0
__dataToPutStride = False
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
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 def __init__(self, **kwargs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 Operation.__init__(self, **kwargs)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 def setup(self, n=None, timeInterval=None, stride=None, overlapping=False, byblock=False):
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 """
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
José Chávez
algunos cambios en roj
r953 n : Number of coherent integrations
timeInterval : Time of integration. If the parameter "n" is selected this one does not work
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
self.__buffer = None
self.__dataReady = False
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.byblock = byblock
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 self.stride = stride
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 == None and timeInterval == None:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("n or timeInterval should be specified ...")
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 != None:
self.n = n
self.__byTime = False
else:
Daniel Valdez
Bug Fixed: AMISR Setup File does not correspond with the experiment range dates...
r510 self.__integrationtime = timeInterval #* 60. #if (type(timeInterval)!=integer) -> change this line
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.n = 9999
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 if overlapping:
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 self.__withOverlapping = True
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
else:
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 self.__withOverlapping = False
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 = 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 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 def putData(self, data):
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 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
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 if not self.__withOverlapping:
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 += data.copy()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 self.__profIndex += 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 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 #Overlapping data
nChannels, nHeis = data.shape
data = numpy.reshape(data, (1, nChannels, nHeis))
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 the buffer is empty then it takes the data value
Miguel Valdez
Bug fixed: Padding decode data with zeros at the first heights was eliminated.
r611 if self.__buffer 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 self.__buffer = data
self.__profIndex += 1
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 #If the buffer length is lower than n then stakcing the data value
if self.__profIndex < self.n:
self.__buffer = numpy.vstack((self.__buffer, data))
self.__profIndex += 1
return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
#If the buffer length is equal to n then replacing the last buffer value with the data value
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 = numpy.roll(self.__buffer, -1, axis=0)
self.__buffer[self.n-1] = data
self.__profIndex = self.n
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
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 if not self.__withOverlapping:
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 = self.__buffer
n = self.__profIndex
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.__buffer = 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, 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 #Integration with Overlapping
data = numpy.sum(self.__buffer, axis=0)
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 # print data
# raise
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
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, 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, data):
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
avgdata = None
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 # n = None
# print data
# raise
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(data)
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:
avgdata, n = self.pushData()
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
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, data, 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 self.__dataReady = False
avgdata = None
n = 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(data)
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, 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
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 def integrateByStride(self, data, datatime):
# print data
if self.__profIndex == 0:
self.__buffer = [[data.copy(), datatime]]
else:
José Chávez
antiguo comportamiento de cohint. Ej: 96 -> 24x4
r1117 self.__buffer.append([data.copy(),datatime])
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 self.__profIndex += 1
self.__dataReady = False
if self.__profIndex == self.n * self.stride :
self.__dataToPutStride = True
self.__profIndexStride = 0
self.__profIndex = 0
self.__bufferStride = []
for i in range(self.stride):
current = self.__buffer[i::self.stride]
data = numpy.sum([t[0] for t in current], axis=0)
avgdatatime = numpy.average([t[1] for t in current])
# print data
self.__bufferStride.append((data, avgdatatime))
if self.__dataToPutStride:
José Chávez
antiguo comportamiento de cohint. Ej: 96 -> 24x4
r1117 self.__dataReady = True
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 self.__profIndexStride += 1
if self.__profIndexStride == self.stride:
self.__dataToPutStride = False
# print self.__bufferStride[self.__profIndexStride - 1]
# raise
José Chávez
antiguo comportamiento de cohint. Ej: 96 -> 24x4
r1117 return self.__bufferStride[self.__profIndexStride - 1]
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 return None, 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 def integrate(self, data, datatime=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 self.__initime == None:
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 = self.byTime(data, datatime)
else:
avgdata = self.byProfiles(data)
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.__lastdatatime = datatime
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed: Padding decode data with zeros at the first heights was eliminated.
r611 if avgdata 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 return None, 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 avgdatatime = self.__initime
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 deltatime = datatime - self.__lastdatatime
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 if not self.__withOverlapping:
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
else:
self.__initime += deltatime
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, avgdatatime
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 def integrateByBlock(self, dataOut):
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 times = int(dataOut.data.shape[1]/self.n)
avgdata = numpy.zeros((dataOut.nChannels, times, dataOut.nHeights), dtype=numpy.complex)
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 id_min = 0
id_max = self.n
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 for i in range(times):
junk = dataOut.data[:,id_min:id_max,:]
avgdata[:,i,:] = junk.sum(axis=1)
id_min += self.n
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 id_max += self.n
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 timeInterval = dataOut.ippSeconds*self.n
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 avgdatatime = (times - 1) * timeInterval + dataOut.utctime
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.__dataReady = True
return avgdata, avgdatatime
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 def run(self, dataOut, n=None, timeInterval=None, stride=None, overlapping=False, byblock=False, **kwargs):
George Yong
Multiprocessing for voltage (all operations) working
r1173
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:
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 self.setup(n=n, stride=stride, timeInterval=timeInterval, overlapping=overlapping, byblock=byblock, **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 = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 if dataOut.flagDataAsBlock:
"""
Si la data es leida por bloques, dimension = [nChannels, nProfiles, nHeis]
"""
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 avgdata, avgdatatime = self.integrateByBlock(dataOut)
Miguel Valdez
Coherent Integration by Blocks: Bug fixed, nProfiles is divided by number of integrations
r720 dataOut.nProfiles /= self.n
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 else:
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279 if stride is None:
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime)
else:
avgdata, avgdatatime = self.integrateByStride(dataOut.data, dataOut.utctime)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 # dataOut.timeInterval *= 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 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.__dataReady:
dataOut.data = avgdata
Juan C. Espinoza
Fix ScpecraWriter and CohInt attribute
r1310 if not dataOut.flagCohInt:
dataOut.nCohInt *= self.n
dataOut.flagCohInt = True
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.utctime = avgdatatime
José Chávez
sumado de stride en stride. ej 96 -> 24x4 -> 1
r1116 # print avgdata, avgdatatime
# raise
# dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt
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.flagNoData = False
updates real multiprocess, save hdf5, utils_Io
r1559
#update Processing Header:
dataOut.processingHeaderObj.nCohInt = dataOut.nCohInt
George Yong
Multiprocessing for voltage (all operations) working
r1173 return dataOut
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177
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 Decoder(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 isConfig = False
__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 code = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
nCode = 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 nBaud = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 def __init__(self, **kwargs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 Operation.__init__(self, **kwargs)
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.times = None
self.osamp = None
José Chávez
cambios xmax xmin
r1004 # self.__setValues = False
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 self.isConfig = False
George Yong
Multiprocessing for voltage (all operations) working
r1173 self.setupReq = False
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 def setup(self, code, osamp, dataOut):
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.__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 self.code = code
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
self.nCode = len(code)
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.nBaud = len(code[0])
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 if (osamp != None) and (osamp >1):
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.osamp = osamp
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 self.code = numpy.repeat(code, repeats=self.osamp, axis=1)
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.nBaud = self.nBaud*self.osamp
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 self.__nChannels = dataOut.nChannels
self.__nProfiles = dataOut.nProfiles
self.__nHeis = dataOut.nHeights
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
GUI: Bug fixed when *Read from header* is selected...
r655 if self.__nHeis < self.nBaud:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError('Number of heights (%d) should be greater than number of bauds (%d)' %(self.__nHeis, self.nBaud))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 #Frequency
__codeBuffer = numpy.zeros((self.nCode, self.__nHeis), dtype=numpy.complex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 __codeBuffer[:,0:self.nBaud] = self.code
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 self.fft_code = numpy.conj(numpy.fft.fft(__codeBuffer, axis=1))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 if dataOut.flagDataAsBlock:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 self.ndatadec = self.__nHeis #- self.nBaud + 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 self.datadecTime = numpy.zeros((self.__nChannels, self.__nProfiles, self.ndatadec), dtype=numpy.complex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 else:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 #Time
Miguel Valdez
Affected:...
r534 self.ndatadec = self.__nHeis #- self.nBaud + 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
self.datadecTime = numpy.zeros((self.__nChannels, self.ndatadec), dtype=numpy.complex)
Miguel Valdez
Bugs fixed:...
r660 def __convolutionInFreq(self, data):
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 fft_code = self.fft_code[self.__profIndex].reshape(1,-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 fft_data = numpy.fft.fft(data, axis=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 conv = fft_data*fft_code
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 = numpy.fft.ifft(conv,axis=1)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 return data
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 def __convolutionInFreqOpt(self, data):
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 raise NotImplementedError
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 def __convolutionInTime(self, data):
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 code = self.code[self.__profIndex]
for i in range(self.__nChannels):
Miguel Valdez
Bug fixed: Padding decode data with zeros at the first heights was eliminated.
r611 self.datadecTime[i,:] = numpy.correlate(data[i,:], code, mode='full')[self.nBaud-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 self.datadecTime
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 def __convolutionByBlockInTime(self, data):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Correcting floats slicing bug
r1236 repetitions = int(self.__nProfiles / self.nCode)
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 junk = numpy.lib.stride_tricks.as_strided(self.code, (repetitions, self.code.size), (0, self.code.itemsize))
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 junk = junk.flatten()
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 code_block = numpy.reshape(junk, (self.nCode*repetitions, self.nBaud))
George Yong
Python 2to3, Spectra (all operations) working
r1167 profilesList = range(self.__nProfiles)
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
for i in range(self.__nChannels):
for j in profilesList:
self.datadecTime[i,j,:] = numpy.correlate(data[i,j,:], code_block[j,:], mode='full')[self.nBaud-1:]
return self.datadecTime
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 def __convolutionByBlockInFreq(self, data):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise NotImplementedError("Decoder by frequency fro Blocks not implemented")
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749
Miguel Valdez
Bugs fixed:...
r660 fft_code = self.fft_code[self.__profIndex].reshape(1,-1)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 fft_data = numpy.fft.fft(data, axis=2)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 conv = fft_data*fft_code
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 data = numpy.fft.ifft(conv,axis=2)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 return data
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
Miguel Valdez
Bug fixed reading voltage data by block....
r605 def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0, osamp=None, times=None):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed:...
r624 if dataOut.flagDecodeData:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("This data is already decoded, recoding again ...")
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 not self.isConfig:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed: Padding decode data with zeros at the first heights was eliminated.
r611 if code is None:
Miguel Valdez
Error comparing "code == None", it was replaced by "code is None:"
r674 if dataOut.code is None:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("Code could not be read from %s instance. Enter a value in Code parameter" %dataOut.type)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 code = dataOut.code
else:
code = numpy.array(code).reshape(nCode,nBaud)
self.setup(code, osamp, dataOut)
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.isConfig = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Ivan Valdez
Bug fixed: importing sys module
r723 if mode == 3:
sys.stderr.write("Decoder Warning: mode=%d is not valid, using mode=0\n" %mode)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if times != None:
sys.stderr.write("Decoder Warning: Argument 'times' in not used anymore\n")
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed:...
r624 if self.code is None:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("Fail decoding: Code is not defined.")
Miguel Valdez
Bug fixed:...
r624 return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Decoder: nProfiles var updated in run
r997 self.__nProfiles = dataOut.nProfiles
Miguel Valdez
Bugs fixed:...
r660 datadec = None
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if mode == 3:
mode = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 if dataOut.flagDataAsBlock:
"""
Decoding when data have been read as block,
"""
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if mode == 0:
datadec = self.__convolutionByBlockInTime(dataOut.data)
if mode == 1:
datadec = self.__convolutionByBlockInFreq(dataOut.data)
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 else:
"""
Decoding when data have been read profile by profile
"""
if mode == 0:
Miguel Valdez
Bugs fixed:...
r660 datadec = self.__convolutionInTime(dataOut.data)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 if mode == 1:
Miguel Valdez
Bugs fixed:...
r660 datadec = self.__convolutionInFreq(dataOut.data)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 if mode == 2:
Miguel Valdez
Bugs fixed:...
r660 datadec = self.__convolutionInFreqOpt(dataOut.data)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if datadec is None:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("Codification mode selected is not valid: mode=%d. Try selecting 0 or 1" %mode)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed: Error decoding data
r544 dataOut.code = self.code
dataOut.nCode = self.nCode
dataOut.nBaud = self.nBaud
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 = datadec
Miguel Valdez
Bugs fixed:...
r660 dataOut.heightList = dataOut.heightList[0:datadec.shape[-1]]
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 dataOut.flagDecodeData = True #asumo q la data esta decodificada
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
update code in spcUpdate from voltage
r1560
updates real multiprocess, save hdf5, utils_Io
r1559 #update Processing Header:
dataOut.radarControllerHeaderObj.code = self.code
dataOut.radarControllerHeaderObj.nCode = self.nCode
dataOut.radarControllerHeaderObj.nBaud = self.nBaud
dataOut.radarControllerHeaderObj.nOsamp = osamp
#update Processing Header:
dataOut.processingHeaderObj.heightList = dataOut.heightList
dataOut.processingHeaderObj.heightResolution = dataOut.heightList[1]-dataOut.heightList[0]
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495
update code in spcUpdate from voltage
r1560 if self.__profIndex == self.nCode-1:
self.__profIndex = 0
return dataOut
self.__profIndex += 1
updates real multiprocess, save hdf5, utils_Io
r1559 return dataOut
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 class ProfileConcat(Operation):
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 isConfig = False
buffer = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 def __init__(self, **kwargs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 Operation.__init__(self, **kwargs)
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.profileIndex = 0
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 def reset(self):
self.buffer = numpy.zeros_like(self.buffer)
self.start_index = 0
self.times = 1
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 def setup(self, data, m, n=1):
self.buffer = numpy.zeros((data.shape[0],data.shape[1]*m),dtype=type(data[0,0]))
Ivan Valdez
r808 self.nHeights = data.shape[1]#.nHeights
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.start_index = 0
self.times = 1
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 def concat(self, data):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Ivan Valdez
r808 self.buffer[:,self.start_index:self.nHeights*self.times] = data.copy()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 self.start_index = self.start_index + self.nHeights
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 def run(self, dataOut, m):
dataOut.flagNoData = True
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 not self.isConfig:
self.setup(dataOut.data, m, 1)
self.isConfig = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 if dataOut.flagDataAsBlock:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("ProfileConcat can only be used when voltage have been read profile by profile, getBlock = False")
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 else:
self.concat(dataOut.data)
self.times += 1
if self.times > m:
dataOut.data = self.buffer
self.reset()
dataOut.flagNoData = False
# se deben actualizar mas propiedades del header y del objeto dataOut, por ejemplo, las alturas
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
Miguel Valdez
Affected:...
r534 xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * m
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight)
Miguel Valdez
Affected:...
r534 dataOut.ippSeconds *= m
updates real multiprocess, save hdf5, utils_Io
r1559
#update Processing Header:
dataOut.processingHeaderObj.heightList = dataOut.heightList
dataOut.processingHeaderObj.ipp = dataOut.ippSeconds
George Yong
Multiprocessing for voltage (all operations) working
r1173 return dataOut
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 class ProfileSelector(Operation):
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 profileIndex = None
# Tamanho total de los perfiles
nProfiles = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 def __init__(self, **kwargs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 Operation.__init__(self, **kwargs)
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 self.profileIndex = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Minor changes
r754 def incProfileIndex(self):
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.profileIndex += 1
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 self.profileIndex >= self.nProfiles:
self.profileIndex = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 def isThisProfileInRange(self, profileIndex, minIndex, maxIndex):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 if profileIndex < minIndex:
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 return False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 if profileIndex > maxIndex:
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 return False
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 return True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 def isThisProfileInList(self, profileIndex, profileList):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 if profileIndex not in profileList:
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 return False
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 return True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI...
r600 def run(self, dataOut, profileList=None, profileRangeList=None, beam=None, byblock=False, rangeList = None, nProfiles=None):
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530
"""
ProfileSelector:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 Inputs:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 profileList : Index of profiles selected. Example: profileList = (0,1,2,7,8)
Miguel Valdez
Affected:...
r534 profileRangeList : Minimum and maximum profile indexes. Example: profileRangeList = (4, 30)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 rangeList : List of profile ranges. Example: rangeList = ((4, 30), (32, 64), (128, 256))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 """
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Feature added to jroproc_voltage.ProfileSelector(): rangeList replaces to profileRangeList. This parameter will be eliminated in future versions.
r756 if rangeList is not None:
if type(rangeList[0]) not in (tuple, list):
rangeList = [rangeList]
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 dataOut.flagNoData = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: Many methods were changed when flagDataAsBlock is set. Different process when data is read as block or profile by profile
r530 if dataOut.flagDataAsBlock:
"""
data dimension = [nChannels, nProfiles, nHeis]
"""
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 if profileList != None:
dataOut.data = dataOut.data[:,profileList,:]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI v2.1
r596 if profileRangeList != None:
Miguel Valdez
Affected:...
r534 minIndex = profileRangeList[0]
maxIndex = profileRangeList[1]
George Yong
Python 2to3, Spectra (all operations) working
r1167 profileList = list(range(minIndex, maxIndex+1))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Affected:...
r534 dataOut.data = dataOut.data[:,minIndex:maxIndex+1,:]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Signal Chain GUI v2.1
r596 if rangeList != None:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 profileList = []
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 for thisRange in rangeList:
minIndex = thisRange[0]
maxIndex = thisRange[1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Python 2to3, Spectra (all operations) working
r1167 profileList.extend(list(range(minIndex, maxIndex+1)))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.data = dataOut.data[:,profileList,:]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.nProfiles = len(profileList)
dataOut.profileIndex = dataOut.nProfiles - 1
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Changes of voltageProc 2to3
r1183 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 """
data dimension = [nChannels, nHeis]
"""
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if profileList != None:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if self.isThisProfileInList(dataOut.profileIndex, profileList):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 self.nProfiles = len(profileList)
dataOut.nProfiles = self.nProfiles
Miguel Valdez
Bugs fixed:...
r660 dataOut.profileIndex = self.profileIndex
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Minor changes
r754 self.incProfileIndex()
George Yong
Changes of voltageProc 2to3
r1183 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if profileRangeList != None:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 minIndex = profileRangeList[0]
maxIndex = profileRangeList[1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if self.isThisProfileInRange(dataOut.profileIndex, minIndex, maxIndex):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 self.nProfiles = maxIndex - minIndex + 1
dataOut.nProfiles = self.nProfiles
Miguel Valdez
Bugs fixed:...
r660 dataOut.profileIndex = self.profileIndex
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Minor changes
r754 self.incProfileIndex()
George Yong
Changes of voltageProc 2to3
r1183 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if rangeList != None:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 nProfiles = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 for thisRange in rangeList:
minIndex = thisRange[0]
maxIndex = thisRange[1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 nProfiles += maxIndex - minIndex + 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 for thisRange in rangeList:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 minIndex = thisRange[0]
maxIndex = thisRange[1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if self.isThisProfileInRange(dataOut.profileIndex, minIndex, maxIndex):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 self.nProfiles = nProfiles
dataOut.nProfiles = self.nProfiles
Miguel Valdez
Affected:...
r534 dataOut.profileIndex = self.profileIndex
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Minor changes
r754 self.incProfileIndex()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 break
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Changes of voltageProc 2to3
r1183 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bugs fixed:...
r660 if beam != None: #beam is only for AMISR data
if self.isThisProfileInList(dataOut.profileIndex, dataOut.beamRangeDict[beam]):
dataOut.flagNoData = False
dataOut.profileIndex = self.profileIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Minor changes
r754 self.incProfileIndex()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Changes of voltageProc 2to3
r1183 return dataOut
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("ProfileSelector needs profileList, profileRangeList or rangeList parameter")
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177
Daniel Valdez
Reading and doing Operation in Blocks to processing radar data from MST_ISR_EEJ Experiment
r495 class Reshaper(Operation):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 def __init__(self, **kwargs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 Operation.__init__(self, **kwargs)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 self.__buffer = None
self.__nitems = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 def __appendProfile(self, dataOut, nTxs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if self.__buffer is None:
shape = (dataOut.nChannels, int(dataOut.nHeights/nTxs) )
self.__buffer = numpy.empty(shape, dtype = dataOut.data.dtype)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 ini = dataOut.nHeights * self.__nitems
end = ini + dataOut.nHeights
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 self.__buffer[:, ini:end] = dataOut.data
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 self.__nitems += 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 return int(self.__nitems*nTxs)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 def __getBuffer(self):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if self.__nitems == int(1./self.__nTxs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 self.__nitems = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 return self.__buffer.copy()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 return None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 def __checkInputs(self, dataOut, shape, nTxs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if shape is None and nTxs is None:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("Reshaper: shape of factor should be defined")
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if nTxs:
if nTxs < 0:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("nTxs should be greater than 0")
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if nTxs < 1 and dataOut.nProfiles % (1./nTxs) != 0:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("nProfiles= %d is not divisibled by (1./nTxs) = %f" %(dataOut.nProfiles, (1./nTxs)))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 shape = [dataOut.nChannels, dataOut.nProfiles*nTxs, dataOut.nHeights/nTxs]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Ivan Valdez
Reshape for nTx > 1
r790 return shape, nTxs
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if len(shape) != 2 and len(shape) != 3:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("shape dimension should be equal to 2 or 3. shape = (nProfiles, nHeis) or (nChannels, nProfiles, nHeis). Actually shape = (%d, %d, %d)" %(dataOut.nChannels, dataOut.nProfiles, dataOut.nHeights))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if len(shape) == 2:
shape_tuple = [dataOut.nChannels]
shape_tuple.extend(shape)
else:
shape_tuple = list(shape)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Ivan Valdez
Reshape for nTx > 1
r790 nTxs = 1.0*shape_tuple[1]/dataOut.nProfiles
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 return shape_tuple, nTxs
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 def run(self, dataOut, shape=None, nTxs=None):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 shape_tuple, self.__nTxs = self.__checkInputs(dataOut, shape, nTxs)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.flagNoData = True
profileIndex = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if dataOut.flagDataAsBlock:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.data = numpy.reshape(dataOut.data, shape_tuple)
dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Ivan Valdez
Reshape for nTx > 1
r790 profileIndex = int(dataOut.nProfiles*self.__nTxs) - 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 else:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if self.__nTxs < 1:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 self.__appendProfile(dataOut, self.__nTxs)
new_data = self.__getBuffer()
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 if new_data is not None:
dataOut.data = new_data
dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 profileIndex = dataOut.profileIndex*nTxs
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 else:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("nTxs should be greater than 0 and lower than 1, or use VoltageReader(..., getblock=True)")
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.heightList = numpy.arange(dataOut.nHeights/self.__nTxs) * deltaHeight + dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.nProfiles = int(dataOut.nProfiles*self.__nTxs)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.profileIndex = profileIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
jroproc_voltage.py: ProfileSelector, Decoder, Reshape was tested with nTxs != 1 and getblock = True
r749 dataOut.ippSeconds /= self.__nTxs
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for voltage (all operations) working
r1173 return dataOut
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 class SplitProfiles(Operation):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 def __init__(self, **kwargs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 Operation.__init__(self, **kwargs)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 def run(self, dataOut, n):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.flagNoData = True
profileIndex = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 if dataOut.flagDataAsBlock:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 #nchannels, nprofiles, nsamples
shape = dataOut.data.shape
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 if shape[2] % n != 0:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("Could not split the data, n=%d has to be multiple of %d" %(n, shape[2]))
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
George Yong
Python 2to3, Voltage (all operations) working
r1168 new_shape = shape[0], shape[1]*n, int(shape[2]/n)
Modificación a kmamisr para ejecutarse en la versión 3, creación de scripts con terminación v3 para difereciarlos, se comentó la linea #720 de JroIO_param.py debido a que reiniciaba la lista de archivos, ocasionando la reescritura del archivo hdf5. Alguna otra modificación aparente es producto de algunas variaciones en espacios al usar la función print()
r1279
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.data = numpy.reshape(dataOut.data, new_shape)
dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 profileIndex = int(dataOut.nProfiles/n) - 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 else:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("Could not split the data when is read Profile by Profile. Use VoltageReader(..., getblock=True)")
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.heightList = numpy.arange(dataOut.nHeights/n) * deltaHeight + dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.nProfiles = int(dataOut.nProfiles*n)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.profileIndex = profileIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.ippSeconds /= n
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for voltage (all operations) working
r1173 return dataOut
Juan C. Espinoza
Review MP changes, three types of operations: self, other and external
r1177
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 class CombineProfiles(Operation):
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 def __init__(self, **kwargs):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 Operation.__init__(self, **kwargs)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 self.__remData = None
self.__profileIndex = 0
def run(self, dataOut, n):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.flagNoData = True
profileIndex = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 if dataOut.flagDataAsBlock:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 #nchannels, nprofiles, nsamples
shape = dataOut.data.shape
new_shape = shape[0], shape[1]/n, shape[2]*n
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 if shape[1] % n != 0:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("Could not split the data, n=%d has to be multiple of %d" %(n, shape[1]))
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.data = numpy.reshape(dataOut.data, new_shape)
dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 profileIndex = int(dataOut.nProfiles*n) - 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 else:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 #nchannels, nsamples
if self.__remData is None:
newData = dataOut.data
else:
newData = numpy.concatenate((self.__remData, dataOut.data), axis=1)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 self.__profileIndex += 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 if self.__profileIndex < n:
self.__remData = newData
#continue
return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 self.__profileIndex = 0
self.__remData = None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.data = newData
dataOut.flagNoData = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 profileIndex = dataOut.profileIndex/n
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.heightList = numpy.arange(dataOut.nHeights*n) * deltaHeight + dataOut.heightList[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.nProfiles = int(dataOut.nProfiles/n)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.profileIndex = profileIndex
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
Miguel Valdez
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
r823 dataOut.ippSeconds *= n
Julio Valdez
-Function to interpolate corrupted profiles
r836
George Yong
Multiprocessing for voltage (all operations) working
r1173 return dataOut
update for weather radar options
r1296
class PulsePairVoltage(Operation):
'''
Function PulsePair(Signal Power, Velocity)
The real component of Lag[0] provides Intensity Information
The imag component of Lag[1] Phase provides Velocity Information
Configuration Parameters:
nPRF = Number of Several PRF
theta = Degree Azimuth angel Boundaries
Input:
self.dataOut
lag[N]
Affected:
self.dataOut.spc
'''
isConfig = False
__profIndex = 0
__initime = None
__lastdatatime = None
__buffer = None
adicion de escritura de datos, calculo de ancho espectral y graficos pulsepair
r1303 noise = None
update for weather radar options
r1296 __dataReady = False
n = None
__nch = 0
__nHeis = 0
removeDC = False
ipp = None
lambda_ = 0
def __init__(self,**kwargs):
Operation.__init__(self,**kwargs)
def setup(self, dataOut, n = None, removeDC=False):
'''
n= Numero de PRF's de entrada
'''
self.__initime = None
self.__lastdatatime = 0
self.__dataReady = False
self.__buffer = 0
self.__profIndex = 0
adicion de escritura de datos, calculo de ancho espectral y graficos pulsepair
r1303 self.noise = None
update for weather radar options
r1296 self.__nch = dataOut.nChannels
self.__nHeis = dataOut.nHeights
self.removeDC = removeDC
self.lambda_ = 3.0e8/(9345.0e6)
self.ippSec = dataOut.ippSeconds
self.nCohInt = dataOut.nCohInt
cambios sendtoServer, lectura spectra desde Hdf5
r1406
update for weather radar options
r1296 if n == None:
raise ValueError("n should be specified.")
if n != None:
if n<2:
raise ValueError("n should be greater than 2")
self.n = n
self.__nProf = n
self.__buffer = numpy.zeros((dataOut.nChannels,
n,
dataOut.nHeights),
dtype='complex')
def putData(self,data):
'''
Add a profile to he __buffer and increase in one the __profiel Index
'''
self.__buffer[:,self.__profIndex,:]= data
self.__profIndex += 1
return
prueba de con ancho espectral y adicion de snr
r1307 def pushData(self,dataOut):
update for weather radar options
r1296 '''
Return the PULSEPAIR and the profiles used in the operation
Affected : self.__profileIndex
'''
Add metadata attribute to data types
r1338 #----------------- Remove DC-----------------------------------
update for weather radar options
r1296 if self.removeDC==True:
mean = numpy.mean(self.__buffer,1)
tmp = mean.reshape(self.__nch,1,self.__nHeis)
dc= numpy.tile(tmp,[1,self.__nProf,1])
self.__buffer = self.__buffer - dc
Add metadata attribute to data types
r1338 #------------------Calculo de Potencia ------------------------
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 pair0 = self.__buffer*numpy.conj(self.__buffer)
pair0 = pair0.real
lag_0 = numpy.sum(pair0,1)
Add metadata attribute to data types
r1338 #------------------Calculo de Ruido x canal--------------------
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 self.noise = numpy.zeros(self.__nch)
for i in range(self.__nch):
daux = numpy.sort(pair0[i,:,:],axis= None)
self.noise[i]=hildebrand_sekhon( daux ,self.nCohInt)
self.noise = self.noise.reshape(self.__nch,1)
self.noise = numpy.tile(self.noise,[1,self.__nHeis])
noise_buffer = self.noise.reshape(self.__nch,1,self.__nHeis)
noise_buffer = numpy.tile(noise_buffer,[1,self.__nProf,1])
Add metadata attribute to data types
r1338 #------------------ Potencia recibida= P , Potencia senal = S , Ruido= N--
#------------------ P= S+N ,P=lag_0/N ---------------------------------
#-------------------- Power --------------------------------------------------
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 data_power = lag_0/(self.n*self.nCohInt)
Add metadata attribute to data types
r1338 #------------------ Senal ---------------------------------------------------
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 data_intensity = pair0 - noise_buffer
data_intensity = numpy.sum(data_intensity,axis=1)*(self.n*self.nCohInt)#*self.nCohInt)
#data_intensity = (lag_0-self.noise*self.n)*(self.n*self.nCohInt)
for i in range(self.__nch):
for j in range(self.__nHeis):
if data_intensity[i][j] < 0:
data_intensity[i][j] = numpy.min(numpy.absolute(data_intensity[i][j]))
update for weather radar options
r1296
Add metadata attribute to data types
r1338 #----------------- Calculo de Frecuencia y Velocidad doppler--------
adicion de escritura de datos, calculo de ancho espectral y graficos pulsepair
r1303 pair1 = self.__buffer[:,:-1,:]*numpy.conjugate(self.__buffer[:,1:,:])
lag_1 = numpy.sum(pair1,1)
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 data_freq = (-1/(2.0*math.pi*self.ippSec*self.nCohInt))*numpy.angle(lag_1)
data_velocity = (self.lambda_/2.0)*data_freq
adicion de escritura de datos, calculo de ancho espectral y graficos pulsepair
r1303
Add metadata attribute to data types
r1338 #---------------- Potencia promedio estimada de la Senal-----------
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 lag_0 = lag_0/self.n
S = lag_0-self.noise
prueba de con ancho espectral y adicion de snr
r1307
Add metadata attribute to data types
r1338 #---------------- Frecuencia Doppler promedio ---------------------
adicion de escritura de datos, calculo de ancho espectral y graficos pulsepair
r1303 lag_1 = lag_1/(self.n-1)
R1 = numpy.abs(lag_1)
prueba de con ancho espectral y adicion de snr
r1307
Add metadata attribute to data types
r1338 #---------------- Calculo del SNR----------------------------------
prueba de con ancho espectral y adicion de snr
r1307 data_snrPP = S/self.noise
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 for i in range(self.__nch):
for j in range(self.__nHeis):
if data_snrPP[i][j] < 1.e-20:
data_snrPP[i][j] = 1.e-20
prueba de con ancho espectral y adicion de snr
r1307
Add metadata attribute to data types
r1338 #----------------- Calculo del ancho espectral ----------------------
adicion de escritura de datos, calculo de ancho espectral y graficos pulsepair
r1303 L = S/R1
L = numpy.where(L<0,1,L)
L = numpy.log(L)
tmp = numpy.sqrt(numpy.absolute(L))
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 data_specwidth = (self.lambda_/(2*math.sqrt(2)*math.pi*self.ippSec*self.nCohInt))*tmp*numpy.sign(L)
update for weather radar options
r1296 n = self.__profIndex
self.__buffer = numpy.zeros((self.__nch, self.__nProf,self.__nHeis), dtype='complex')
self.__profIndex = 0
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 return data_power,data_intensity,data_velocity,data_snrPP,data_specwidth,n
update for weather radar options
r1296
prueba de con ancho espectral y adicion de snr
r1307 def pulsePairbyProfiles(self,dataOut):
update for weather radar options
r1296
self.__dataReady = False
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 data_power = None
update for weather radar options
r1296 data_intensity = None
data_velocity = None
adicion de escritura de datos, calculo de ancho espectral y graficos pulsepair
r1303 data_specwidth = None
prueba de con ancho espectral y adicion de snr
r1307 data_snrPP = None
self.putData(data=dataOut.data)
update for weather radar options
r1296 if self.__profIndex == self.n:
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 data_power,data_intensity, data_velocity,data_snrPP,data_specwidth, n = self.pushData(dataOut=dataOut)
update for weather radar options
r1296 self.__dataReady = True
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 return data_power, data_intensity, data_velocity, data_snrPP, data_specwidth
update for weather radar options
r1296
prueba de con ancho espectral y adicion de snr
r1307 def pulsePairOp(self, dataOut, datatime= None):
update for weather radar options
r1296
if self.__initime == None:
self.__initime = datatime
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 data_power, data_intensity, data_velocity, data_snrPP, data_specwidth = self.pulsePairbyProfiles(dataOut)
update for weather radar options
r1296 self.__lastdatatime = datatime
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 if data_power is None:
return None, None, None,None,None,None
update for weather radar options
r1296
avgdatatime = self.__initime
deltatime = datatime - self.__lastdatatime
self.__initime = datatime
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 return data_power, data_intensity, data_velocity, data_snrPP, data_specwidth, avgdatatime
update for weather radar options
r1296
def run(self, dataOut,n = None,removeDC= False, overlapping= False,**kwargs):
if not self.isConfig:
self.setup(dataOut = dataOut, n = n , removeDC=removeDC , **kwargs)
self.isConfig = True
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 data_power, data_intensity, data_velocity,data_snrPP,data_specwidth, avgdatatime = self.pulsePairOp(dataOut, dataOut.utctime)
update for weather radar options
r1296 dataOut.flagNoData = True
if self.__dataReady:
dataOut.nCohInt *= self.n
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314 dataOut.dataPP_POW = data_intensity # S
dataOut.dataPP_POWER = data_power # P
dataOut.dataPP_DOP = data_velocity
dataOut.dataPP_SNR = data_snrPP
dataOut.dataPP_WIDTH = data_specwidth
update for weather radar options
r1296 dataOut.PRFbyAngle = self.n #numero de PRF*cada angulo rotado que equivale a un tiempo.
dataOut.utctime = avgdatatime
dataOut.flagNoData = False
return dataOut
modifiacion de la clase pulse pair, correcion de errores del Noise con removeDC y los 4 momentos
r1314
Miguel Valdez
Bug fixed:...
r624 # import collections
# from scipy.stats import mode
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # class Synchronize(Operation):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # isConfig = False
# __profIndex = 0
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
# def __init__(self, **kwargs):
#
# Operation.__init__(self, **kwargs)
Miguel Valdez
Bug fixed:...
r624 # # self.isConfig = False
# self.__powBuffer = None
# self.__startIndex = 0
# self.__pulseFound = False
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # def __findTxPulse(self, dataOut, channel=0, pulse_with = None):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # #Read data
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # powerdB = dataOut.getPower(channel = channel)
# noisedB = dataOut.getNoise(channel = channel)[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # self.__powBuffer.extend(powerdB.flatten())
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # dataArray = numpy.array(self.__powBuffer)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # filteredPower = numpy.correlate(dataArray, dataArray[0:self.__nSamples], "same")
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # maxValue = numpy.nanmax(filteredPower)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # if maxValue < noisedB + 10:
# #No se encuentra ningun pulso de transmision
# return None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # maxValuesIndex = numpy.where(filteredPower > maxValue - 0.1*abs(maxValue))[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # if len(maxValuesIndex) < 2:
# #Solo se encontro un solo pulso de transmision de un baudio, esperando por el siguiente TX
# return None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # phasedMaxValuesIndex = maxValuesIndex - self.__nSamples
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # #Seleccionar solo valores con un espaciamiento de nSamples
# pulseIndex = numpy.intersect1d(maxValuesIndex, phasedMaxValuesIndex)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # if len(pulseIndex) < 2:
# #Solo se encontro un pulso de transmision con ancho mayor a 1
# return None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # spacing = pulseIndex[1:] - pulseIndex[:-1]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # #remover senales que se distancien menos de 10 unidades o muestras
# #(No deberian existir IPP menor a 10 unidades)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # realIndex = numpy.where(spacing > 10 )[0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # if len(realIndex) < 2:
# #Solo se encontro un pulso de transmision con ancho mayor a 1
# return None
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # #Eliminar pulsos anchos (deja solo la diferencia entre IPPs)
# realPulseIndex = pulseIndex[realIndex]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # period = mode(realPulseIndex[1:] - realPulseIndex[:-1])[0][0]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # print "IPP = %d samples" %period
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # self.__newNSamples = dataOut.nHeights #int(period)
# self.__startIndex = int(realPulseIndex[0])
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # return 1
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
#
Miguel Valdez
Bug fixed:...
r624 # def setup(self, nSamples, nChannels, buffer_size = 4):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # self.__powBuffer = collections.deque(numpy.zeros( buffer_size*nSamples,dtype=numpy.float),
# maxlen = buffer_size*nSamples)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # bufferList = []
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # for i in range(nChannels):
# bufferByChannel = collections.deque(numpy.zeros( buffer_size*nSamples, dtype=numpy.complex) + numpy.NAN,
# maxlen = buffer_size*nSamples)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # bufferList.append(bufferByChannel)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # self.__nSamples = nSamples
# self.__nChannels = nChannels
# self.__bufferList = bufferList
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # def run(self, dataOut, channel = 0):
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # if not self.isConfig:
# nSamples = dataOut.nHeights
# nChannels = dataOut.nChannels
# self.setup(nSamples, nChannels)
# self.isConfig = True
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # #Append new data to internal buffer
# for thisChannel in range(self.__nChannels):
# bufferByChannel = self.__bufferList[thisChannel]
# bufferByChannel.extend(dataOut.data[thisChannel])
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # if self.__pulseFound:
# self.__startIndex -= self.__nSamples
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # #Finding Tx Pulse
# if not self.__pulseFound:
# indexFound = self.__findTxPulse(dataOut, channel)
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # if indexFound == None:
# dataOut.flagNoData = True
# return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # self.__arrayBuffer = numpy.zeros((self.__nChannels, self.__newNSamples), dtype = numpy.complex)
# self.__pulseFound = True
# self.__startIndex = indexFound
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # #If pulse was found ...
# for thisChannel in range(self.__nChannels):
# bufferByChannel = self.__bufferList[thisChannel]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 # #print self.__startIndex
Miguel Valdez
Bug fixed:...
r624 # x = numpy.array(bufferByChannel)
# self.__arrayBuffer[thisChannel] = x[self.__startIndex:self.__startIndex+self.__newNSamples]
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
# dataOut.heightList = numpy.arange(self.__newNSamples)*deltaHeight
# # dataOut.ippSeconds = (self.__newNSamples / deltaHeight)/1e6
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # dataOut.data = self.__arrayBuffer
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
Miguel Valdez
Bug fixed:...
r624 # self.__startIndex += self.__newNSamples
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 #
George Yong
Multiprocessing for voltage (all operations) working
r1173 # return
cambios para amisr ISR
r1465 class SSheightProfiles(Operation):
step = None
nsamples = None
bufferShape = None
profileShape = None
sshProfiles = None
profileIndex = None
def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
self.isConfig = False
def setup(self,dataOut ,step = None , nsamples = None):
if step == None and nsamples == None:
raise ValueError("step or nheights should be specified ...")
self.step = step
self.nsamples = nsamples
self.__nChannels = dataOut.nChannels
self.__nProfiles = dataOut.nProfiles
self.__nHeis = dataOut.nHeights
shape = dataOut.data.shape #nchannels, nprofiles, nsamples
residue = (shape[1] - self.nsamples) % self.step
if residue != 0:
print("The residue is %d, step=%d should be multiple of %d to avoid loss of %d samples"%(residue,step,shape[1] - self.nsamples,residue))
deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
numberProfile = self.nsamples
numberSamples = (shape[1] - self.nsamples)/self.step
self.bufferShape = int(shape[0]), int(numberSamples), int(numberProfile) # nchannels, nsamples , nprofiles
self.profileShape = int(shape[0]), int(numberProfile), int(numberSamples) # nchannels, nprofiles, nsamples
self.buffer = numpy.zeros(self.bufferShape , dtype=numpy.complex)
self.sshProfiles = numpy.zeros(self.profileShape, dtype=numpy.complex)
def run(self, dataOut, step, nsamples, code = None, repeat = None):
dataOut.flagNoData = True
profileIndex = None
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 #print("nProfiles, nHeights ",dataOut.nProfiles, dataOut.nHeights)
cambios para amisr ISR
r1465 #print(dataOut.getFreqRange(1)/1000.)
#exit(1)
if dataOut.flagDataAsBlock:
dataOut.data = numpy.average(dataOut.data,axis=1)
#print("jee")
dataOut.flagDataAsBlock = False
if not self.isConfig:
self.setup(dataOut, step=step , nsamples=nsamples)
#print("Setup done")
self.isConfig = True
if code is not None:
code = numpy.array(code)
code_block = code
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
cambios para amisr ISR
r1465 if repeat is not None:
code_block = numpy.repeat(code_block, repeats=repeat, axis=1)
#print(code_block.shape)
for i in range(self.buffer.shape[1]):
if code is not None:
self.buffer[:,i] = dataOut.data[:,i*self.step:i*self.step + self.nsamples]*code_block
else:
self.buffer[:,i] = dataOut.data[:,i*self.step:i*self.step + self.nsamples]#*code[dataOut.profileIndex,:]
#self.buffer[:,j,self.__nHeis-j*self.step - self.nheights:self.__nHeis-j*self.step] = numpy.flip(dataOut.data[:,j*self.step:j*self.step + self.nheights])
for j in range(self.buffer.shape[0]):
self.sshProfiles[j] = numpy.transpose(self.buffer[j])
profileIndex = self.nsamples
deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
ippSeconds = (deltaHeight*1.0e-6)/(0.15)
#print("ippSeconds, dH: ",ippSeconds,deltaHeight)
try:
if dataOut.concat_m is not None:
ippSeconds= ippSeconds/float(dataOut.concat_m)
#print "Profile concat %d"%dataOut.concat_m
except:
pass
dataOut.data = self.sshProfiles
dataOut.flagNoData = False
dataOut.heightList = numpy.arange(self.buffer.shape[1]) *self.step*deltaHeight + dataOut.heightList[0]
dataOut.nProfiles = int(dataOut.nProfiles*self.nsamples)
dataOut.profileIndex = profileIndex
dataOut.flagDataAsBlock = True
dataOut.ippSeconds = ippSeconds
dataOut.step = self.step
#print(numpy.shape(dataOut.data))
#exit(1)
grafico outliers, grafico de integraciones, funciones de obtención ruído, etc
r1540 #print("new data shape and time:", dataOut.data.shape, dataOut.utctime)
cambios para amisr ISR
r1465
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 return dataOut
################################################################################3############################3
################################################################################3############################3
################################################################################3############################3
################################################################################3############################3
class SSheightProfiles2(Operation):
'''
Procesa por perfiles y por bloques
snr coorection for rem sats
r1566 Versión corregida y actualizada para trabajar con RemoveProfileSats2
Usar esto
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 '''
grafico outliers, grafico de integraciones, funciones de obtención ruído, etc
r1540
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 bufferShape = None
profileShape = None
sshProfiles = None
profileIndex = None
grafico outliers, grafico de integraciones, funciones de obtención ruído, etc
r1540 #nsamples = None
#step = None
#deltaHeight = None
#init_range = None
__slots__ = ('step', 'nsamples', 'deltaHeight', 'init_range', 'isConfig', '__nChannels',
'__nProfiles', '__nHeis', 'deltaHeight', 'new_nHeights')
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
self.isConfig = False
def setup(self,dataOut ,step = None , nsamples = None):
if step == None and nsamples == None:
raise ValueError("step or nheights should be specified ...")
self.step = step
self.nsamples = nsamples
self.__nChannels = int(dataOut.nChannels)
self.__nProfiles = int(dataOut.nProfiles)
self.__nHeis = int(dataOut.nHeights)
residue = (self.__nHeis - self.nsamples) % self.step
if residue != 0:
proc schain amisr isr1
r1547 print("The residue is %d, step=%d should be multiple of %d to avoid loss of %d samples"%(residue,step,self.__nProfiles - self.nsamples,residue))
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 self.deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
self.init_range = dataOut.heightList[0]
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 #numberProfile = self.nsamples
grafico outliers, grafico de integraciones, funciones de obtención ruído, etc
r1540 numberSamples = (self.__nHeis - self.nsamples)/self.step
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
grafico outliers, grafico de integraciones, funciones de obtención ruído, etc
r1540 self.new_nHeights = numberSamples
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
grafico outliers, grafico de integraciones, funciones de obtención ruído, etc
r1540 self.bufferShape = int(self.__nChannels), int(numberSamples), int(self.nsamples) # nchannels, nsamples , nprofiles
self.profileShape = int(self.__nChannels), int(self.nsamples), int(numberSamples) # nchannels, nprofiles, nsamples
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
self.buffer = numpy.zeros(self.bufferShape , dtype=numpy.complex)
self.sshProfiles = numpy.zeros(self.profileShape, dtype=numpy.complex)
def getNewProfiles(self, data, code=None, repeat=None):
if code is not None:
code = numpy.array(code)
code_block = code
if repeat is not None:
code_block = numpy.repeat(code_block, repeats=repeat, axis=1)
proc schain amisr isr1
r1547 if data.ndim < 3:
data = data.reshape(self.__nChannels,1,self.__nHeis )
#print("buff, data, :",self.buffer.shape, data.shape,self.sshProfiles.shape, code_block.shape)
for ch in range(self.__nChannels):
for i in range(int(self.new_nHeights)): #nuevas alturas
if code is not None:
self.buffer[ch,i,:] = data[ch,:,i*self.step:i*self.step + self.nsamples]*code_block
else:
self.buffer[ch,i,:] = data[ch,:,i*self.step:i*self.step + self.nsamples]#*code[dataOut.profileIndex,:]
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
for j in range(self.__nChannels): #en los cananles
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 self.sshProfiles[j,:,:] = numpy.transpose(self.buffer[j,:,:])
#print("new profs Done")
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
def run(self, dataOut, step, nsamples, code = None, repeat = None):
proc schain amisr isr1
r1547 # print("running")
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 if dataOut.flagNoData == True:
return dataOut
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 dataOut.flagNoData = True
#print("init data shape:", dataOut.data.shape)
#print("ch: {} prof: {} hs: {}".format(int(dataOut.nChannels),
# int(dataOut.nProfiles),int(dataOut.nHeights)))
profileIndex = None
# if not dataOut.flagDataAsBlock:
# dataOut.nProfiles = 1
if not self.isConfig:
self.setup(dataOut, step=step , nsamples=nsamples)
#print("Setup done")
self.isConfig = True
dataBlock = None
nprof = 1
if dataOut.flagDataAsBlock:
nprof = int(dataOut.nProfiles)
#print("dataOut nProfiles:", dataOut.nProfiles)
for profile in range(nprof):
if dataOut.flagDataAsBlock:
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #print("read blocks")
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 self.getNewProfiles(dataOut.data[:,profile,:], code=code, repeat=repeat)
else:
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #print("read profiles")
self.getNewProfiles(dataOut.data, code=code, repeat=repeat) #only one channe
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 if profile == 0:
dataBlock = self.sshProfiles.copy()
else: #by blocks
dataBlock = numpy.concatenate((dataBlock,self.sshProfiles), axis=1) #profile axis
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #print("by blocks: ",dataBlock.shape, self.sshProfiles.shape)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
profileIndex = self.nsamples
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
ippSeconds = (self.deltaHeight*1.0e-6)/(0.15)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
dataOut.data = dataBlock
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #print("show me: ",self.step,self.deltaHeight, dataOut.heightList, self.new_nHeights)
dataOut.heightList = numpy.arange(int(self.new_nHeights)) *self.step*self.deltaHeight + self.init_range
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 dataOut.sampled_heightsFFT = self.nsamples
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 dataOut.ippSeconds = ippSeconds
dataOut.step = self.step
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 dataOut.deltaHeight = self.step*self.deltaHeight
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 dataOut.flagNoData = False
if dataOut.flagDataAsBlock:
dataOut.nProfiles = int(dataOut.nProfiles*self.nsamples)
else:
dataOut.nProfiles = int(self.nsamples)
dataOut.profileIndex = dataOut.nProfiles
dataOut.flagDataAsBlock = True
dataBlock = None
grafico outliers, grafico de integraciones, funciones de obtención ruído, etc
r1540
#print("new data shape:", dataOut.data.shape, dataOut.utctime)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
updates real multiprocess, save hdf5, utils_Io
r1559 #update Processing Header:
dataOut.processingHeaderObj.heightList = dataOut.heightList
dataOut.processingHeaderObj.ipp = ippSeconds
dataOut.processingHeaderObj.heightResolution = dataOut.deltaHeight
#dataOut.processingHeaderObj.profilesPerBlock = nProfiles
Interference from YAGI removed, remHeightsIppInterf added
r1579
# # dataOut.data = CH, PROFILES, HEIGHTS
#print(dataOut.data .shape)
if dataOut.flagProfilesByRange:
# #assuming the same remotion for all channels
aux = [ self.nsamples - numpy.count_nonzero(dataOut.data[0, :, h]==0) for h in range(len(dataOut.heightList))]
hdf5 nProfilesByRange corrected
r1585 dataOut.nProfilesByRange = (numpy.asarray(aux)).reshape((1,len(dataOut.heightList) ))
#print(dataOut.nProfilesByRange.shape)
Interference from YAGI removed, remHeightsIppInterf added
r1579 else:
hdf5 nProfilesByRange corrected
r1585 dataOut.nProfilesByRange = numpy.ones((1, len(dataOut.heightList)))*dataOut.nProfiles
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 return dataOut
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 class RemoveProfileSats(Operation):
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 '''
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 Escrito: Joab Apaza
remSatsProfiles
r1548 Omite los perfiles contaminados con señal de satélites, usando una altura de referencia
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 In: minHei = min_sat_range
max_sat_range
min_hei_ref
max_hei_ref
th = diference between profiles mean, ref and sats
Out:
profile clean
'''
remSatsProfiles
r1548 __buffer_data = []
__buffer_times = []
buffer = None
outliers_IDs_list = []
__slots__ = ('n','navg','profileMargin','thHistOutlier','minHei_idx','maxHei_idx','nHeights',
'first_utcBlock','__profIndex','init_prof','end_prof','lenProfileOut','nChannels',
'__count_exec','__initime','__dataReady','__ipp', 'minRef', 'maxRef', 'thdB')
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
self.isConfig = False
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 def setup(self,dataOut, n=None , navg=0.8, profileMargin=50,thHistOutlier=15,
remSatsProfiles
r1548 minHei=None, maxHei=None, minRef=None, maxRef=None, thdB=10):
if n == None and timeInterval == None:
raise ValueError("nprofiles or timeInterval should be specified ...")
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 if n != None:
self.n = n
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 self.navg = navg
self.profileMargin = profileMargin
self.thHistOutlier = thHistOutlier
self.__profIndex = 0
self.buffer = None
self._ipp = dataOut.ippSeconds
self.n_prof_released = 0
self.heightList = dataOut.heightList
self.init_prof = 0
self.end_prof = 0
self.__count_exec = 0
self.__profIndex = 0
self.first_utcBlock = None
#self.__dh = dataOut.heightList[1] - dataOut.heightList[0]
minHei = minHei
maxHei = maxHei
if minHei==None :
minHei = dataOut.heightList[0]
if maxHei==None :
maxHei = dataOut.heightList[-1]
self.minHei_idx,self.maxHei_idx = getHei_index(minHei, maxHei, dataOut.heightList)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 self.min_ref, self.max_ref = getHei_index(minRef, maxRef, dataOut.heightList)
remSatsProfiles
r1548 self.nChannels = dataOut.nChannels
self.nHeights = dataOut.nHeights
self.test_counter = 0
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 self.thdB = thdB
remSatsProfiles
r1548 def filterSatsProfiles(self):
data = self.__buffer_data
#print(data.shape)
nChannels, profiles, heights = data.shape
indexes=numpy.zeros([], dtype=int)
outliers_IDs=[]
for c in range(nChannels):
#print(self.min_ref,self.max_ref)
noise_ref = 10* numpy.log10((data[c,:,self.min_ref:self.max_ref] * numpy.conjugate(data[c,:,self.min_ref:self.max_ref])).real)
#print("Noise ",numpy.percentile(noise_ref,95))
p95 = numpy.percentile(noise_ref,95)
noise_ref = noise_ref.mean()
#print("Noise ",noise_ref
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528
remSatsProfiles
r1548 for h in range(self.minHei_idx, self.maxHei_idx):
power = 10* numpy.log10((data[c,:,h] * numpy.conjugate(data[c,:,h])).real)
#th = noise_ref + self.thdB
th = noise_ref + 1.5*(p95-noise_ref)
index = numpy.where(power > th )
if index[0].size > 10 and index[0].size < int(self.navg*profiles):
indexes = numpy.append(indexes, index[0])
#print(index[0])
#print(index[0])
# fig,ax = plt.subplots()
# #ax.set_title(str(k)+" "+str(j))
# x=range(len(power))
# ax.scatter(x,power)
# #ax.axvline(index)
# plt.grid()
# plt.show()
#print(indexes)
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528
remSatsProfiles
r1548 #outliers_IDs = outliers_IDs.astype(numpy.dtype('int64'))
#outliers_IDs = numpy.unique(outliers_IDs)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 outs_lines = numpy.unique(indexes)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 #Agrupando el histograma de outliers,
my_bins = numpy.linspace(0,int(profiles), int(profiles/100), endpoint=True)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 hist, bins = numpy.histogram(outs_lines,bins=my_bins)
hist_outliers_indexes = numpy.where(hist > self.thHistOutlier) #es outlier
hist_outliers_indexes = hist_outliers_indexes[0]
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 # if len(hist_outliers_indexes>0):
# hist_outliers_indexes = numpy.append(hist_outliers_indexes,hist_outliers_indexes[-1]+1)
remSatsProfiles
r1548 #print(hist_outliers_indexes)
#print(bins, hist_outliers_indexes)
bins_outliers_indexes = [int(i) for i in (bins[hist_outliers_indexes])] #
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 outlier_loc_index = []
# for n in range(len(bins_outliers_indexes)):
# for e in range(bins_outliers_indexes[n]-self.profileMargin,bins_outliers_indexes[n]+ self.profileMargin):
# outlier_loc_index.append(e)
remSatsProfiles
r1548 outlier_loc_index = [e for n in range(len(bins_outliers_indexes)) for e in range(bins_outliers_indexes[n]-self.profileMargin,bins_outliers_indexes[n]+ profiles//100 + self.profileMargin) ]
outlier_loc_index = numpy.asarray(outlier_loc_index)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
#print("outliers Ids: ", outlier_loc_index, outlier_loc_index.shape)
outlier_loc_index = outlier_loc_index[ (outlier_loc_index >= 0) & (outlier_loc_index<profiles)]
#print("outliers final: ", outlier_loc_index)
from matplotlib import pyplot as plt
x, y = numpy.meshgrid(numpy.arange(profiles), self.heightList)
fig, ax = plt.subplots(1,2,figsize=(8, 6))
dat = data[0,:,:].real
dat = 10* numpy.log10((data[0,:,:] * numpy.conjugate(data[0,:,:])).real)
m = numpy.nanmean(dat)
o = numpy.nanstd(dat)
#print(m, o, x.shape, y.shape)
#c = ax[0].pcolormesh(x, y, dat.T, cmap ='YlGnBu', vmin = (m-2*o), vmax = (m+2*o))
c = ax[0].pcolormesh(x, y, dat.T, cmap ='YlGnBu', vmin = 50, vmax = 75)
ax[0].vlines(outs_lines,200,600, linestyles='dashed', label = 'outs', color='w')
fig.colorbar(c)
ax[0].vlines(outlier_loc_index,650,750, linestyles='dashed', label = 'outs', color='r')
ax[1].hist(outs_lines,bins=my_bins)
plt.show()
self.outliers_IDs_list = outlier_loc_index
#print("outs list: ", self.outliers_IDs_list)
return data
def fillBuffer(self, data, datatime):
if self.__profIndex == 0:
self.__buffer_data = data.copy()
else:
self.__buffer_data = numpy.concatenate((self.__buffer_data,data), axis=1)#en perfiles
self.__profIndex += 1
self.__buffer_times.append(datatime)
def getData(self, data, datatime=None):
if self.__profIndex == 0:
self.__initime = datatime
self.__dataReady = False
self.fillBuffer(data, datatime)
dataBlock = None
if self.__profIndex == self.n:
#print("apnd : ",data)
dataBlock = self.filterSatsProfiles()
self.__dataReady = True
return dataBlock
if dataBlock is None:
return None, None
return dataBlock
def releaseBlock(self):
if self.n % self.lenProfileOut != 0:
raise ValueError("lenProfileOut %d must be submultiple of nProfiles %d" %(self.lenProfileOut, self.n))
return None
data = self.buffer[:,self.init_prof:self.end_prof:,:] #ch, prof, alt
self.init_prof = self.end_prof
self.end_prof += self.lenProfileOut
#print("data release shape: ",dataOut.data.shape, self.end_prof)
self.n_prof_released += 1
return data
def run(self, dataOut, n=None, navg=0.8, nProfilesOut=1, profile_margin=50,
th_hist_outlier=15,minHei=None, maxHei=None, minRef=None, maxRef=None, thdB=10):
if not self.isConfig:
#print("init p idx: ", dataOut.profileIndex )
self.setup(dataOut,n=n, navg=navg,profileMargin=profile_margin,thHistOutlier=th_hist_outlier,
minHei=minHei, maxHei=maxHei, minRef=minRef, maxRef=maxRef, thdB=thdB)
self.isConfig = True
dataBlock = None
if not dataOut.buffer_empty: #hay datos acumulados
if self.init_prof == 0:
self.n_prof_released = 0
self.lenProfileOut = nProfilesOut
dataOut.flagNoData = False
#print("tp 2 ",dataOut.data.shape)
self.init_prof = 0
self.end_prof = self.lenProfileOut
dataOut.nProfiles = self.lenProfileOut
if nProfilesOut == 1:
dataOut.flagDataAsBlock = False
else:
dataOut.flagDataAsBlock = True
#print("prof: ",self.init_prof)
dataOut.flagNoData = False
if numpy.isin(self.n_prof_released, self.outliers_IDs_list):
#print("omitting: ", self.n_prof_released)
dataOut.flagNoData = True
dataOut.ippSeconds = self._ipp
dataOut.utctime = self.first_utcBlock + self.init_prof*self._ipp
# print("time: ", dataOut.utctime, self.first_utcBlock, self.init_prof,self._ipp,dataOut.ippSeconds)
#dataOut.data = self.releaseBlock()
#########################################################3
if self.n % self.lenProfileOut != 0:
raise ValueError("lenProfileOut %d must be submultiple of nProfiles %d" %(self.lenProfileOut, self.n))
return None
dataOut.data = None
if nProfilesOut == 1:
dataOut.data = self.buffer[:,self.end_prof-1,:] #ch, prof, alt
else:
dataOut.data = self.buffer[:,self.init_prof:self.end_prof,:] #ch, prof, alt
self.init_prof = self.end_prof
self.end_prof += self.lenProfileOut
#print("data release shape: ",dataOut.data.shape, self.end_prof, dataOut.flagNoData)
self.n_prof_released += 1
if self.end_prof >= (self.n +self.lenProfileOut):
self.init_prof = 0
self.__profIndex = 0
self.buffer = None
dataOut.buffer_empty = True
self.outliers_IDs_list = []
self.n_prof_released = 0
dataOut.flagNoData = False #enviar ultimo aunque sea outlier :(
#print("cleaning...", dataOut.buffer_empty)
dataOut.profileIndex = 0 #self.lenProfileOut
####################################################################
return dataOut
#print("tp 223 ",dataOut.data.shape)
dataOut.flagNoData = True
try:
#dataBlock = self.getData(dataOut.data.reshape(self.nChannels,1,self.nHeights), dataOut.utctime)
dataBlock = self.getData(numpy.reshape(dataOut.data,(self.nChannels,1,self.nHeights)), dataOut.utctime)
self.__count_exec +=1
except Exception as e:
print("Error getting profiles data",self.__count_exec )
print(e)
sys.exit()
if self.__dataReady:
#print("omitting: ", len(self.outliers_IDs_list))
self.__count_exec = 0
#dataOut.data =
#self.buffer = numpy.flip(dataBlock, axis=1)
self.buffer = dataBlock
self.first_utcBlock = self.__initime
dataOut.utctime = self.__initime
dataOut.nProfiles = self.__profIndex
#dataOut.flagNoData = False
self.init_prof = 0
self.__profIndex = 0
self.__initime = None
dataBlock = None
self.__buffer_times = []
dataOut.error = False
dataOut.useInputBuffer = True
dataOut.buffer_empty = False
#print("1 ch: {} prof: {} hs: {}".format(int(dataOut.nChannels),int(dataOut.nProfiles),int(dataOut.nHeights)))
#print(self.__count_exec)
return dataOut
class RemoveProfileSats2(Operation):
'''
Escrito: Joab Apaza
Omite los perfiles contaminados con señal de satélites, usando una altura de referencia
updates real multiprocess, save hdf5, utils_Io
r1559 promedia todas las alturas para los cálculos
Rem Yagi profiles from amisr data
r1590 In:
n = Cantidad de perfiles que se acumularan, usualmente 10 segundos
navg = Porcentaje de perfiles que puede considerarse como satélite, máximo 90%
minHei =
minRef =
maxRef =
nBins =
profile_margin =
th_hist_outlier =
nProfilesOut =
Pensado para remover interferencias de las YAGI, se puede adaptar a otras interferencias
remYagi = Activa la funcion de remoción de interferencias de la YAGI
nProfYagi = Cantidad de perfiles que son afectados, acorde NTX de la YAGI
offYagi =
minHJULIA = Altura mínima donde aparece la señal referencia de JULIA (-50)
maxHJULIA = Altura máxima donde aparece la señal referencia de JULIA (-15)
debug = Activa los gráficos, recomendable ejecutar para ajustar los parámetros
para un experimento en específico.
** se modifica para remover interferencias puntuales, es decir, desde otros radares.
Inicialmente se ha configurado para omitir también los perfiles de la YAGI en los datos
de AMISR-ISR.
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 Out:
profile clean
'''
__buffer_data = []
__buffer_times = []
buffer = None
outliers_IDs_list = []
__slots__ = ('n','navg','profileMargin','thHistOutlier','minHei_idx','maxHei_idx','nHeights',
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 'first_utcBlock','__profIndex','init_prof','end_prof','lenProfileOut','nChannels','cohFactor',
plot reduction solved
r1657 '__count_exec','__initime','__dataReady','__ipp', 'minRef', 'maxRef', 'debug','prev_pnoise','thfactor')
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
self.isConfig = False
Rem Yagi profiles from amisr data
r1590 self.currentTime = None
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 def setup(self,dataOut, n=None , navg=0.9, profileMargin=50,thHistOutlier=15,minHei=None, maxHei=None, nBins=10,
Rem Yagi profiles from amisr data
r1590 minRef=None, maxRef=None, debug=False, remYagi=False, nProfYagi = 0, offYagi=0, minHJULIA=None, maxHJULIA=None,
plot reduction solved
r1657 idate=None,startH=None,endH=None, thfactor=1 ):
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
if n == None and timeInterval == None:
raise ValueError("nprofiles or timeInterval should be specified ...")
if n != None:
self.n = n
self.navg = navg
self.profileMargin = profileMargin
self.thHistOutlier = thHistOutlier
self.__profIndex = 0
self.buffer = None
self._ipp = dataOut.ippSeconds
self.n_prof_released = 0
self.heightList = dataOut.heightList
self.init_prof = 0
self.end_prof = 0
self.__count_exec = 0
self.__profIndex = 0
self.first_utcBlock = None
self.prev_pnoise = None
Rem Yagi profiles from amisr data
r1590 self.nBins = nBins
plot reduction solved
r1657 self.thfactor = thfactor
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 #self.__dh = dataOut.heightList[1] - dataOut.heightList[0]
minHei = minHei
maxHei = maxHei
if minHei==None :
minHei = dataOut.heightList[0]
if maxHei==None :
maxHei = dataOut.heightList[-1]
self.minHei_idx,self.maxHei_idx = getHei_index(minHei, maxHei, dataOut.heightList)
self.min_ref, self.max_ref = getHei_index(minRef, maxRef, dataOut.heightList)
self.nChannels = dataOut.nChannels
self.nHeights = dataOut.nHeights
self.test_counter = 0
Rem Yagi profiles from amisr data
r1590 self.debug = debug
self.remYagi = remYagi
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 self.cohFactor = dataOut.nCohInt
Rem Yagi profiles from amisr data
r1590 if self.remYagi :
if minHJULIA==None or maxHJULIA==None:
raise ValueError("Parameters minHYagi and minHYagi are necessary!")
return
if idate==None or startH==None or endH==None:
raise ValueError("Date and hour parameters are necessary!")
return
self.minHJULIA_idx,self.maxHJULIA_idx = getHei_index(minHJULIA, maxHJULIA, dataOut.heightList)
self.offYagi = offYagi
self.nTxYagi = nProfYagi
self.startTime = datetime.datetime.combine(idate,startH)
self.endTime = datetime.datetime.combine(idate,endH)
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 log.warning("Be careful with the selection of parameters for sats removal! It is avisable to \
Rem Yagi profiles from amisr data
r1590 activate the debug parameter in this operation for calibration", self.name)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
def filterSatsProfiles(self):
data = self.__buffer_data.copy()
#print(data.shape)
nChannels, profiles, heights = data.shape
indexes=numpy.zeros([], dtype=int)
indexes = numpy.delete(indexes,0)
Rem Yagi profiles from amisr data
r1590
indexesYagi=numpy.zeros([], dtype=int)
indexesYagi = numpy.delete(indexesYagi,0)
indexesYagi_up=numpy.zeros([], dtype=int)
indexesYagi_up = numpy.delete(indexesYagi_up,0)
indexesYagi_down=numpy.zeros([], dtype=int)
indexesYagi_down = numpy.delete(indexesYagi_down,0)
indexesJULIA=numpy.zeros([], dtype=int)
indexesJULIA = numpy.delete(indexesJULIA,0)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 outliers_IDs=[]
Rem Yagi profiles from amisr data
r1590
div = profiles//self.nBins
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
for c in range(nChannels):
#print(self.min_ref,self.max_ref)
import scipy.signal
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 b, a = scipy.signal.butter(3, 0.5)
#noise_ref = (data[c,:,self.min_ref:self.max_ref] * numpy.conjugate(data[c,:,self.min_ref:self.max_ref]))
noise_ref = numpy.abs(data[c,:,self.min_ref:self.max_ref])
lnoise = len(noise_ref[0,:])
#print(noise_ref.shape)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 noise_ref = noise_ref.mean(axis=1)
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 #fnoise = noise_ref
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 fnoise = scipy.signal.filtfilt(b, a, noise_ref)
#noise_refdB = 10* numpy.log10(noise_ref)
#print("Noise ",numpy.percentile(noise_ref,95))
plot reduction solved
r1657 p95 = numpy.percentile(fnoise,95)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 mean_noise = fnoise.mean()
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 if self.prev_pnoise != None:
plot reduction solved
r1657 if mean_noise < (1.1 * self.prev_pnoise) and mean_noise > (0.9 * self.prev_pnoise):
mean_noise = 0.9*mean_noise + 0.1*self.prev_pnoise
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 self.prev_pnoise = mean_noise
else:
mean_noise = self.prev_pnoise
else:
self.prev_pnoise = mean_noise
std = fnoise.std()+ fnoise.mean()
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 #power = (data[c,:,self.minHei_idx:self.maxHei_idx] * numpy.conjugate(data[c,:,self.minHei_idx:self.maxHei_idx]))
power = numpy.abs(data[c,:,self.minHei_idx:self.maxHei_idx])
npower = len(power[0,:])
#print(power.shape)
power = power.mean(axis=1)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
fpower = scipy.signal.filtfilt(b, a, power)
#print(power.shape)
#powerdB = 10* numpy.log10(power)
plot reduction solved
r1657 #th = p95 * self.thfactor
th = mean_noise * self.thfactor
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 index = numpy.where(fpower > th )
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 #print("Noise ",mean_noise, p95)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 #print(index)
plot reduction solved
r1657
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655
plot reduction solved
r1657 if index[0].size <= int(self.navg*profiles): #outliers from sats
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 indexes = numpy.append(indexes, index[0])
plot reduction solved
r1657 index2low = numpy.where(fpower < (th*0.5 )) #outliers from no TX
if index2low[0].size <= int(self.navg*profiles):
indexes = numpy.append(indexes, index2low[0])
Rem Yagi profiles from amisr data
r1590 #print("sdas ", noise_ref.mean())
if self.remYagi :
#print(self.minHJULIA_idx, self.maxHJULIA_idx)
powerJULIA = (data[c,:,self.minHJULIA_idx:self.maxHJULIA_idx] * numpy.conjugate(data[c,:,self.minHJULIA_idx:self.maxHJULIA_idx])).real
powerJULIA = powerJULIA.mean(axis=1)
th_JULIA = powerJULIA.mean()*0.85
indexJULIA = numpy.where(powerJULIA >= th_JULIA )
indexesJULIA= numpy.append(indexesJULIA, indexJULIA[0])
# fig, ax = plt.subplots()
# ax.plot(powerJULIA)
# ax.axhline(th_JULIA, color='r')
# plt.grid()
# plt.show()
max_nIncohInt changed as @property, correction for normFactor used as matrix
r1554
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 if self.debug:
fig, ax = plt.subplots()
ax.plot(fpower, label="power")
#ax.plot(fnoise, label="noise ref")
ax.axhline(th, color='g', label="th")
#ax.axhline(std, color='b', label="mean")
ax.legend()
plt.grid()
plt.show()
max_nIncohInt changed as @property, correction for normFactor used as matrix
r1554
#print(indexes)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
#outliers_IDs = outliers_IDs.astype(numpy.dtype('int64'))
#outliers_IDs = numpy.unique(outliers_IDs)
Rem Yagi profiles from amisr data
r1590 # print(indexesJULIA)
if len(indexesJULIA > 1):
iJ = indexesJULIA
locs = [ (iJ[n]-iJ[n-1]) > 5 for n in range(len(iJ))]
locs_2 = numpy.where(locs)[0]
#print(locs_2, indexesJULIA[locs_2-1])
indexesYagi_up = numpy.append(indexesYagi_up, indexesJULIA[locs_2-1])
indexesYagi_down = numpy.append(indexesYagi_down, indexesJULIA[locs_2])
indexesYagi_up = numpy.append(indexesYagi_up,indexesJULIA[-1])
indexesYagi_down = numpy.append(indexesYagi_down,indexesJULIA[0])
indexesYagi_up = numpy.unique(indexesYagi_up)
indexesYagi_down = numpy.unique(indexesYagi_down)
aux_ind = [ numpy.arange( (self.offYagi + k)+1, (self.offYagi + k + self.nTxYagi)+1, 1, dtype=int) for k in indexesYagi_up]
indexesYagi_up = (numpy.asarray(aux_ind)).flatten()
aux_ind2 = [ numpy.arange( (k - self.nTxYagi)+1, k+1 , 1, dtype=int) for k in indexesYagi_down]
indexesYagi_down = (numpy.asarray(aux_ind2)).flatten()
indexesYagi = numpy.append(indexesYagi,indexesYagi_up)
indexesYagi = numpy.append(indexesYagi,indexesYagi_down)
indexesYagi = indexesYagi[ (indexesYagi >= 0) & (indexesYagi<profiles)]
indexesYagi = numpy.unique(indexesYagi)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 #print("indexes: " ,indexes)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 outs_lines = numpy.unique(indexes)
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 #print(outs_lines)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
#Agrupando el histograma de outliers,
my_bins = numpy.linspace(0,int(profiles), div, endpoint=True)
hist, bins = numpy.histogram(outs_lines,bins=my_bins)
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 #print("hist: ",hist)
hist_outliers_indexes = numpy.where(hist >= self.thHistOutlier)[0] #es outlier
plot reduction solved
r1657 # print(hist_outliers_indexes)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 if len(hist_outliers_indexes>0):
hist_outliers_indexes = numpy.append(hist_outliers_indexes,hist_outliers_indexes[-1]+1)
plot reduction solved
r1657 bins_outliers_indexes = [int(i)+1 for i in (bins[hist_outliers_indexes])] #
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 outlier_loc_index = []
max_nIncohInt changed as @property, correction for normFactor used as matrix
r1554 #print("out indexes ", bins_outliers_indexes)
plot reduction solved
r1657
# if len(bins_outliers_indexes) <= 2:
# extprof = 0
# else:
# extprof = self.profileMargin
extprof = self.profileMargin
max_nIncohInt changed as @property, correction for normFactor used as matrix
r1554 outlier_loc_index = [e for n in range(len(bins_outliers_indexes)) for e in range(bins_outliers_indexes[n]-extprof,bins_outliers_indexes[n] + extprof) ]
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 outlier_loc_index = numpy.asarray(outlier_loc_index)
# if len(outlier_loc_index)>1:
# ipmax = numpy.where(fpower==fpower.max())[0]
# print("pmax: ",ipmax)
Rem Yagi profiles from amisr data
r1590
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553
remSatsProfiles
r1548 #print("outliers Ids: ", outlier_loc_index, outlier_loc_index.shape)
outlier_loc_index = outlier_loc_index[ (outlier_loc_index >= 0) & (outlier_loc_index<profiles)]
#print("outliers final: ", outlier_loc_index)
Rem Yagi profiles from amisr data
r1590
if self.debug:
x, y = numpy.meshgrid(numpy.arange(profiles), self.heightList)
fig, ax = plt.subplots(nChannels,2,figsize=(8, 6))
for i in range(nChannels):
dat = data[i,:,:].real
dat = 10* numpy.log10((data[i,:,:] * numpy.conjugate(data[i,:,:])).real)
m = numpy.nanmean(dat)
o = numpy.nanstd(dat)
if nChannels>1:
c = ax[i][0].pcolormesh(x, y, dat.T, cmap ='jet', vmin = 60, vmax = 70)
ax[i][0].vlines(outs_lines,650,700, linestyles='dashed', label = 'outs', color='w')
#fig.colorbar(c)
ax[i][0].vlines(outlier_loc_index,700,750, linestyles='dashed', label = 'outs', color='r')
ax[i][1].hist(outs_lines,bins=my_bins)
if self.remYagi :
ax[0].vlines(indexesYagi,750,850, linestyles='dashed', label = 'yagi', color='m')
else:
upgrade filterbyHeights, fix initial parameters. removeProfileSats2 improved debug
r1655 c = ax[0].pcolormesh(x, y, dat.T, cmap ='jet', vmin = 60, vmax = (70+2*self.cohFactor))
Rem Yagi profiles from amisr data
r1590 ax[0].vlines(outs_lines,650,700, linestyles='dashed', label = 'outs', color='w')
#fig.colorbar(c)
ax[0].vlines(outlier_loc_index,700,750, linestyles='dashed', label = 'outs', color='r')
ax[1].hist(outs_lines,bins=my_bins)
if self.remYagi :
ax[0].vlines(indexesYagi,750,850, linestyles='dashed', label = 'yagi', color='m')
plt.show()
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Rem Yagi profiles from amisr data
r1590 if self.remYagi and (self.currentTime < self.startTime and self.currentTime < self.endTime):
outlier_loc_index = numpy.append(outlier_loc_index,indexesYagi)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Rem Yagi profiles from amisr data
r1590 self.outliers_IDs_list = numpy.unique(outlier_loc_index)
remSatsProfiles
r1548 #print("outs list: ", self.outliers_IDs_list)
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 return self.__buffer_data
remSatsProfiles
r1548
def fillBuffer(self, data, datatime):
if self.__profIndex == 0:
self.__buffer_data = data.copy()
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 else:
remSatsProfiles
r1548 self.__buffer_data = numpy.concatenate((self.__buffer_data,data), axis=1)#en perfiles
self.__profIndex += 1
self.__buffer_times.append(datatime)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 def getData(self, data, datatime=None):
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 if self.__profIndex == 0:
self.__initime = datatime
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 self.__dataReady = False
self.fillBuffer(data, datatime)
dataBlock = None
if self.__profIndex == self.n:
#print("apnd : ",data)
dataBlock = self.filterSatsProfiles()
self.__dataReady = True
return dataBlock
if dataBlock is None:
return None, None
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548
return dataBlock
def releaseBlock(self):
if self.n % self.lenProfileOut != 0:
raise ValueError("lenProfileOut %d must be submultiple of nProfiles %d" %(self.lenProfileOut, self.n))
return None
data = self.buffer[:,self.init_prof:self.end_prof:,:] #ch, prof, alt
self.init_prof = self.end_prof
self.end_prof += self.lenProfileOut
#print("data release shape: ",dataOut.data.shape, self.end_prof)
self.n_prof_released += 1
return data
Rem Yagi profiles from amisr data
r1590 def run(self, dataOut, n=None, navg=0.9, nProfilesOut=1, profile_margin=50, th_hist_outlier=15,minHei=None,nBins=10,
maxHei=None, minRef=None, maxRef=None, debug=False, remYagi=False, nProfYagi = 0, offYagi=0, minHJULIA=None, maxHJULIA=None,
plot reduction solved
r1657 idate=None,startH=None,endH=None, thfactor=1):
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
if not self.isConfig:
remSatsProfiles
r1548 #print("init p idx: ", dataOut.profileIndex )
Rem Yagi profiles from amisr data
r1590 self.setup(dataOut,n=n, navg=navg,profileMargin=profile_margin,thHistOutlier=th_hist_outlier,minHei=minHei,
nBins=10, maxHei=maxHei, minRef=minRef, maxRef=maxRef, debug=debug, remYagi=remYagi, nProfYagi = nProfYagi,
plot reduction solved
r1657 offYagi=offYagi, minHJULIA=minHJULIA,maxHJULIA=maxHJULIA,idate=idate,startH=startH,endH=endH, thfactor=thfactor)
Rem Yagi profiles from amisr data
r1590
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 self.isConfig = True
remSatsProfiles
r1548 dataBlock = None
Rem Yagi profiles from amisr data
r1590 self.currentTime = datetime.datetime.fromtimestamp(dataOut.utctime)
remSatsProfiles
r1548
if not dataOut.buffer_empty: #hay datos acumulados
if self.init_prof == 0:
self.n_prof_released = 0
self.lenProfileOut = nProfilesOut
dataOut.flagNoData = False
#print("tp 2 ",dataOut.data.shape)
self.init_prof = 0
self.end_prof = self.lenProfileOut
dataOut.nProfiles = self.lenProfileOut
if nProfilesOut == 1:
dataOut.flagDataAsBlock = False
else:
dataOut.flagDataAsBlock = True
#print("prof: ",self.init_prof)
dataOut.flagNoData = False
if numpy.isin(self.n_prof_released, self.outliers_IDs_list):
#print("omitting: ", self.n_prof_released)
dataOut.flagNoData = True
dataOut.ippSeconds = self._ipp
dataOut.utctime = self.first_utcBlock + self.init_prof*self._ipp
# print("time: ", dataOut.utctime, self.first_utcBlock, self.init_prof,self._ipp,dataOut.ippSeconds)
#dataOut.data = self.releaseBlock()
#########################################################3
if self.n % self.lenProfileOut != 0:
raise ValueError("lenProfileOut %d must be submultiple of nProfiles %d" %(self.lenProfileOut, self.n))
return None
true parallel proc by channels, added class MergeH5(), renamed utils->utilsIO
r1553 dataOut.data = None
if nProfilesOut == 1:
dataOut.data = self.buffer[:,self.end_prof-1,:] #ch, prof, alt
else:
dataOut.data = self.buffer[:,self.init_prof:self.end_prof,:] #ch, prof, alt
remSatsProfiles
r1548
self.init_prof = self.end_prof
self.end_prof += self.lenProfileOut
#print("data release shape: ",dataOut.data.shape, self.end_prof, dataOut.flagNoData)
self.n_prof_released += 1
if self.end_prof >= (self.n +self.lenProfileOut):
self.init_prof = 0
self.__profIndex = 0
self.buffer = None
dataOut.buffer_empty = True
self.outliers_IDs_list = []
self.n_prof_released = 0
dataOut.flagNoData = False #enviar ultimo aunque sea outlier :(
#print("cleaning...", dataOut.buffer_empty)
snr coorection for rem sats
r1566 dataOut.profileIndex = self.__profIndex
remSatsProfiles
r1548 ####################################################################
return dataOut
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
remSatsProfiles
r1548 #print("tp 223 ",dataOut.data.shape)
dataOut.flagNoData = True
try:
#dataBlock = self.getData(dataOut.data.reshape(self.nChannels,1,self.nHeights), dataOut.utctime)
dataBlock = self.getData(numpy.reshape(dataOut.data,(self.nChannels,1,self.nHeights)), dataOut.utctime)
self.__count_exec +=1
except Exception as e:
print("Error getting profiles data",self.__count_exec )
print(e)
sys.exit()
if self.__dataReady:
#print("omitting: ", len(self.outliers_IDs_list))
self.__count_exec = 0
#dataOut.data =
#self.buffer = numpy.flip(dataBlock, axis=1)
self.buffer = dataBlock
self.first_utcBlock = self.__initime
dataOut.utctime = self.__initime
dataOut.nProfiles = self.__profIndex
#dataOut.flagNoData = False
self.init_prof = 0
self.__profIndex = 0
self.__initime = None
dataBlock = None
self.__buffer_times = []
dataOut.error = False
dataOut.useInputBuffer = True
dataOut.buffer_empty = False
#print("1 ch: {} prof: {} hs: {}".format(int(dataOut.nChannels),int(dataOut.nProfiles),int(dataOut.nHeights)))
#print(self.__count_exec)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
cambios para amisr ISR
r1465 return dataOut
Interference from YAGI removed, remHeightsIppInterf added
r1579
class remHeightsIppInterf(Operation):
update remHeightsIppInterf
r1583 def __init__(self, **kwargs):
Interference from YAGI removed, remHeightsIppInterf added
r1579
update remHeightsIppInterf
r1583 Operation.__init__(self, **kwargs)
self.isConfig = False
Interference from YAGI removed, remHeightsIppInterf added
r1579
self.heights_indx = None
self.heightsList = []
self.ipp1 = None
self.ipp2 = None
self.tx1 = None
self.tx2 = None
self.dh1 = None
def setup(self, dataOut, ipp1=None, ipp2=None, tx1=None, tx2=None, dh1=None,
idate=None, startH=None, endH=None):
self.ipp1 = ipp1
self.ipp2 = ipp2
self.tx1 = tx1
self.tx2 = tx2
self.dh1 = dh1
_maxIpp1R = dataOut.heightList.max()
_n_repeats = int(_maxIpp1R / ipp2)
_init_hIntf = (tx1 + ipp2/2)+ dh1
_n_hIntf = int(tx2 / dh1)
self.heightsList = [_init_hIntf+n*ipp2 for n in range(_n_repeats) ]
heiList = dataOut.heightList
self.heights_indx = [getHei_index(h,h,heiList)[0] for h in self.heightsList]
self.heights_indx = [ numpy.asarray([k for k in range(_n_hIntf+2)])+(getHei_index(h,h,heiList)[0] -1) for h in self.heightsList]
self.heights_indx = numpy.asarray(self.heights_indx )
update remHeightsIppInterf
r1583 self.isConfig = True
Interference from YAGI removed, remHeightsIppInterf added
r1579 self.startTime = datetime.datetime.combine(idate,startH)
self.endTime = datetime.datetime.combine(idate,endH)
#print(self.startTime, self.endTime)
#print("nrepeats: ", _n_repeats, " _nH: ",_n_hIntf )
update remHeightsIppInterf
r1583
log.warning("Heights set to zero (km): ", self.name)
log.warning(str((dataOut.heightList[self.heights_indx].flatten())), self.name)
log.warning("Be careful with the selection of heights for noise calculation!")
Interference from YAGI removed, remHeightsIppInterf added
r1579
def run(self, dataOut, ipp1=None, ipp2=None, tx1=None, tx2=None, dh1=None, idate=None,
startH=None, endH=None):
#print(locals().values())
if None in locals().values():
log.warning('Missing kwargs, invalid values """None""" ', self.name)
return dataOut
update remHeightsIppInterf
r1583 if not self.isConfig:
Interference from YAGI removed, remHeightsIppInterf added
r1579 self.setup(dataOut, ipp1=ipp1, ipp2=ipp2, tx1=tx1, tx2=tx2, dh1=dh1,
idate=idate, startH=startH, endH=endH)
update remHeightsIppInterf
r1583 dataOut.flagProfilesByRange = False
Interference from YAGI removed, remHeightsIppInterf added
r1579 currentTime = datetime.datetime.fromtimestamp(dataOut.utctime)
if currentTime < self.startTime or currentTime > self.endTime:
return dataOut
for ch in range(dataOut.data.shape[0]):
for hk in self.heights_indx.flatten():
if dataOut.data.ndim < 3:
zeroPoints include for zero padding
r1641 dataOut.data[ch,hk] = 0.0 + 0.0j
Interference from YAGI removed, remHeightsIppInterf added
r1579 else:
zeroPoints include for zero padding
r1641 dataOut.data[ch,:,hk] = 0.0 + 0.0j
Interference from YAGI removed, remHeightsIppInterf added
r1579
dataOut.flagProfilesByRange = True
update remHeightsIppInterf
r1583
plot reduction solved
r1657 return dataOut
2D spectra for voltage data, and profiles2Block operation
r1660
class profiles2Block(Operation):
'''
Escrito: Joab Apaza
genera un bloque de perfiles
Out:
block
'''
isConfig = False
__buffer_data = []
__buffer_times = []
__profIndex = 0
__byTime = False
__initime = None
__lastdatatime = None
buffer = None
n = None
__dataReady = False
__nChannels = None
__nHeis = None
def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
self.isConfig = False
def setup(self,n=None, timeInterval=None):
if n == None and timeInterval == None:
raise ValueError("n or timeInterval should be specified ...")
if n != None:
self.n = n
self.__byTime = False
else:
self.__integrationtime = timeInterval #* 60. #if (type(timeInterval)!=integer) -> change this line
self.n = 9999
self.__byTime = True
self.__profIndex = 0
def fillBuffer(self, data, datatime):
if self.__profIndex == 0:
self.__buffer_data = data.copy()
else:
self.__buffer_data = numpy.concatenate((self.__buffer_data,data), axis=1)#en perfiles
self.__profIndex += 1
self.__buffer_times.append(datatime)
def getData(self, data, datatime=None):
if self.__initime == None:
self.__initime = datatime
if data.ndim < 3:
data = data.reshape(self.__nChannels,1,self.__nHeis )
if self.__byTime:
dataBlock = self.byTime(data, datatime)
else:
dataBlock = self.byProfiles(data, datatime)
self.__lastdatatime = datatime
if dataBlock is None:
return None, None
return dataBlock, self.__buffer_times
def byProfiles(self, data, datatime):
self.__dataReady = False
dataBlock = None
# n = None
# print data
# raise
self.fillBuffer(data, datatime)
if self.__profIndex == self.n:
dataBlock = self.__buffer_data
self.__dataReady = True
return dataBlock
def byTime(self, data, datatime):
self.__dataReady = False
dataBlock = None
n = None
self.fillBuffer(data, datatime)
if (datatime - self.__initime) >= self.__integrationtime:
dataBlock = self.__buffer_data
self.n = self.__profIndex
self.__dataReady = True
return dataBlock
def run(self, dataOut, n=None, timeInterval=None, **kwargs):
if not self.isConfig:
self.setup(n=n, timeInterval=timeInterval, **kwargs)
self.__nChannels = dataOut.nChannels
self.__nHeis = len(dataOut.heightList)
self.isConfig = True
if dataOut.flagDataAsBlock:
"""
Si la data es leida por bloques, dimension = [nChannels, nProfiles, nHeis]
"""
raise ValueError("The data is already a block")
return
else:
dataBlock, timeBlock = self.getData(dataOut.data, dataOut.utctime)
# print(dataOut.data.shape)
# dataOut.timeInterval *= n
dataOut.flagNoData = True
if self.__dataReady:
dataOut.data = dataBlock
dataOut.flagDataAsBlock = True
dataOut.utctime = timeBlock[-1]
dataOut.nProfiles = self.__profIndex
# print avgdata, avgdatatime
# raise
dataOut.flagNoData = False
self.__profIndex = 0
self.__initime = None
#update Processing Header:
# print(dataOut.data.shape)
return dataOut