##// END OF EJS Templates
Multiprocessing for voltage (all operations) working
Multiprocessing for voltage (all operations) working

File last commit:

r1173:0148df60175f
r1173:0148df60175f
Show More
jroIO_voltage.py
764 lines | 24.9 KiB | text/x-python | PythonLexer
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 '''
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 Created on Jul 2, 2014
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 @author: roj-idl71
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 '''
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 import numpy
George Yong
Python 2to3, Spectra (all operations) working
r1167 from .jroIO_base import LOCALTIME, JRODataReader, JRODataWriter
George Yong
Multiprocessing for voltage (all operations) working
r1173 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader
from schainpy.model.data.jrodata import Voltage
José Chávez
voltage
r1061 import zmq
import tempfile
George Yong
Python 2to3, Spectra (all operations) working
r1167 from io import StringIO
Julio Valdez
voltage reader enhancements
r834 # from _sha import blocksize
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
George Yong
Multiprocessing for voltage (all operations) working
r1173 @MPDecorator
Daniel Valdez
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 VoltageReader(JRODataReader, ProcessingUnit):
"""
Esta clase permite leer datos de voltage desde archivos en formato rawdata (.r). La lectura
José Chávez
voltage
r1061 de los datos siempre se realiza por bloques. Los datos leidos (array de 3 dimensiones:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 perfiles*alturas*canales) son almacenados en la variable "buffer".
José Chávez
voltage
r1061 perfiles * alturas * canales
Esta clase contiene instancias (objetos) de las clases BasicHeader, SystemHeader,
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 RadarControllerHeader y Voltage. Los tres primeros se usan para almacenar informacion de la
cabecera de datos (metadata), y el cuarto (Voltage) para obtener y almacenar un perfil de
datos desde el "buffer" cada vez que se ejecute el metodo "getData".
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Example:
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 dpath = "/home/myuser/data"
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 startTime = datetime.datetime(2010,1,20,0,0,0,0,0,0)
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 endTime = datetime.datetime(2010,1,21,23,59,59,0,0,0)
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 readerObj = VoltageReader()
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 readerObj.setup(dpath, startTime, endTime)
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 while(True):
José Chávez
voltage
r1061
#to get one profile
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 profile = readerObj.getData()
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 #print the profile
print profile
José Chávez
voltage
r1061
Daniel Valdez
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 you want to see all datablock
print readerObj.datablock
José Chávez
voltage
r1061
Daniel Valdez
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 readerObj.flagNoMoreFiles:
break
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
ext = ".r"
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 optchar = "D"
dataOut = None
José Chávez
voltage
r1061
George Yong
Multiprocessing for voltage (all operations) working
r1173 def __init__(self):#, **kwargs):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
Inicializador de la clase VoltageReader para la lectura de datos de voltage.
José Chávez
voltage
r1061
Daniel Valdez
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:
dataOut : Objeto de la clase Voltage. Este objeto sera utilizado para
almacenar un perfil de datos cada vez que se haga un requerimiento
(getData). El perfil sera obtenido a partir del buffer de datos,
si el buffer esta vacio se hara un nuevo proceso de lectura de un
bloque de datos.
Si este parametro no es pasado se creara uno internamente.
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Variables afectadas:
self.dataOut
José Chávez
voltage
r1061
Daniel Valdez
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
"""
José Chávez
voltage
r1061
George Yong
Multiprocessing for voltage (all operations) working
r1173 ProcessingUnit.__init__(self)#, **kwargs)
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.isConfig = False
José Chávez
voltage
r1061
Daniel Valdez
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.datablock = None
José Chávez
voltage
r1061
Daniel Valdez
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.utc = 0
José Chávez
voltage
r1061
Daniel Valdez
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.ext = ".r"
José Chávez
voltage
r1061
Daniel Valdez
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.optchar = "D"
self.basicHeaderObj = BasicHeader(LOCALTIME)
José Chávez
voltage
r1061
Daniel Valdez
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.systemHeaderObj = SystemHeader()
José Chávez
voltage
r1061
Daniel Valdez
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.radarControllerHeaderObj = RadarControllerHeader()
José Chávez
voltage
r1061
Daniel Valdez
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.processingHeaderObj = ProcessingHeader()
José Chávez
voltage
r1061
Daniel Valdez
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.online = 0
José Chávez
voltage
r1061
Daniel Valdez
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.fp = None
José Chávez
voltage
r1061
Daniel Valdez
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.idFile = None
José Chávez
voltage
r1061
Daniel Valdez
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.dtype = None
José Chávez
voltage
r1061
Daniel Valdez
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.fileSizeByHeader = None
José Chávez
voltage
r1061
Daniel Valdez
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.filenameList = []
José Chávez
voltage
r1061
Daniel Valdez
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.filename = None
José Chávez
voltage
r1061
Daniel Valdez
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.fileSize = None
José Chávez
voltage
r1061
Daniel Valdez
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.firstHeaderSize = 0
José Chávez
voltage
r1061
Daniel Valdez
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.basicHeaderSize = 24
José Chávez
voltage
r1061
Daniel Valdez
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.pathList = []
José Chávez
voltage
r1061
Daniel Valdez
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.filenameList = []
José Chávez
voltage
r1061
Daniel Valdez
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.lastUTTime = 0
José Chávez
voltage
r1061
Daniel Valdez
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.maxTimeStep = 30
José Chávez
voltage
r1061
Daniel Valdez
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.flagNoMoreFiles = 0
José Chávez
voltage
r1061
Daniel Valdez
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.set = 0
José Chávez
voltage
r1061
Daniel Valdez
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.path = None
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.profileIndex = 2**32 - 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
José Chávez
formatting
r1082 self.delay = 3 # seconds
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.nTries = 3 # quantity tries
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.nFiles = 3 # number of files for searching
José Chávez
voltage
r1061
Daniel Valdez
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.nReadBlocks = 0
José Chávez
voltage
r1061
Daniel Valdez
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.flagIsNewFile = 1
José Chávez
voltage
r1061
Daniel Valdez
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.__isFirstTimeOnline = 1
José Chávez
voltage
r1061
Daniel Valdez
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.ippSeconds = 0
José Chávez
voltage
r1061
self.flagDiscontinuousBlock = 0
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.flagIsNewBlock = 0
José Chávez
voltage
r1061
Daniel Valdez
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.nTotalBlocks = 0
José Chávez
voltage
r1061
Daniel Valdez
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.blocksize = 0
José Chávez
voltage
r1061
Daniel Valdez
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 = self.createObjByDefault()
José Chávez
voltage
r1061
Miguel Valdez
Affected:...
r534 self.nTxs = 1
José Chávez
voltage
r1061
Miguel Valdez
Affected:...
r534 self.txIndex = 0
José Chávez
voltage
r1061
Daniel Valdez
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 createObjByDefault(self):
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 dataObj = Voltage()
José Chávez
voltage
r1061
Daniel Valdez
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 dataObj
José Chávez
voltage
r1061
Daniel Valdez
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 __hasNotDataInBuffer(self):
José Chávez
voltage
r1061
José Chávez
formatting
r1082 if self.profileIndex >= self.processingHeaderObj.profilesPerBlock * self.nTxs:
Daniel Valdez
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
voltage
r1061
Daniel Valdez
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 0
def getBlockDimension(self):
"""
José Chávez
cambios para online offline
r1019 Obtiene la cantidad de puntos a leer por cada bloque de datos
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Affected:
self.blocksize
Daniel Valdez
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
cambios para online offline
r1019 Return:
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 """
José Chávez
formatting
r1082 pts2read = self.processingHeaderObj.profilesPerBlock * \
self.processingHeaderObj.nHeights * self.systemHeaderObj.nChannels
Daniel Valdez
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.blocksize = pts2read
def readBlock(self):
"""
José Chávez
cambios para online offline
r1019 readBlock lee el bloque de datos desde la posicion actual del puntero del archivo
(self.fp) y actualiza todos los parametros relacionados al bloque de datos
(metadata + data). La data leida es almacenada en el buffer y el contador del buffer
es seteado a 0
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Inputs:
None
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Return:
None
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Affected:
self.profileIndex
self.datablock
self.flagIsNewFile
self.flagIsNewBlock
self.nTotalBlocks
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Exceptions:
Si un bloque leido no es un bloque valido
Daniel Valdez
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
formatting
r1082
José Chávez
test zmq for rawdata
r975 # if self.server is not None:
# self.zBlock = self.receiver.recv()
# self.zHeader = self.zBlock[:24]
# self.zDataBlock = self.zBlock[24:]
# junk = numpy.fromstring(self.zDataBlock, numpy.dtype([('real','<i4'),('imag','<i4')]))
# self.processingHeaderObj.profilesPerBlock = 240
# self.processingHeaderObj.nHeights = 248
# self.systemHeaderObj.nChannels
# else:
current_pointer_location = self.fp.tell()
José Chávez
formatting
r1082 junk = numpy.fromfile(self.fp, self.dtype, self.blocksize)
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
José Chávez
formatting
r1082 junk = junk.reshape((self.processingHeaderObj.profilesPerBlock,
self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 except:
José Chávez
formatting
r1082 # print "The read block (%3d) has not enough data" %self.nReadBlocks
José Chávez
voltage
r1061
Daniel Valdez
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.waitDataBlock(pointer_location=current_pointer_location):
José Chávez
formatting
r1082 junk = numpy.fromfile(self.fp, self.dtype, self.blocksize)
junk = junk.reshape((self.processingHeaderObj.profilesPerBlock,
self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels))
José Chávez
formatting, bug en controller.py
r1017 # return 0
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616
José Chávez
formatting
r1082 # Dimensions : nChannels, nProfiles, nSamples
José Chávez
voltage
r1061
José Chávez
formatting
r1082 junk = numpy.transpose(junk, (2, 0, 1))
self.datablock = junk['real'] + junk['imag'] * 1j
José Chávez
voltage
r1061
Daniel Valdez
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 = 0
José Chávez
voltage
r1061
Daniel Valdez
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.flagIsNewFile = 0
self.flagIsNewBlock = 1
self.nTotalBlocks += 1
self.nReadBlocks += 1
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
def getFirstHeader(self):
José Chávez
voltage
r1061
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 self.getBasicHeader()
José Chávez
voltage
r1061
José Chávez
digital rf fixes
r1103 self.dataOut.processingHeaderObj = self.processingHeaderObj.copy()
Daniel Valdez
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.systemHeaderObj = self.systemHeaderObj.copy()
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.radarControllerHeaderObj = self.radarControllerHeaderObj.copy()
José Chávez
voltage
r1061
Miguel Valdez
Affected:...
r534 if self.nTxs > 1:
José Chávez
formatting
r1082 self.dataOut.radarControllerHeaderObj.ippSeconds = self.radarControllerHeaderObj.ippSeconds / self.nTxs
# Time interval and code are propierties of dataOut. Its value depends of radarControllerHeaderObj.
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
José Chávez
formatting, bug en controller.py
r1017 # self.dataOut.timeInterval = self.radarControllerHeaderObj.ippSeconds * self.processingHeaderObj.nCohInt
#
# if self.radarControllerHeaderObj.code is not None:
#
# self.dataOut.nCode = self.radarControllerHeaderObj.nCode
#
# self.dataOut.nBaud = self.radarControllerHeaderObj.nBaud
#
# self.dataOut.code = self.radarControllerHeaderObj.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 self.dataOut.dtype = self.dtype
José Chávez
voltage
r1061
Miguel Valdez
Support for VoltageReader when nTxs is >1 or <1
r748 self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.dataOut.heightList = numpy.arange(
self.processingHeaderObj.nHeights) * self.processingHeaderObj.deltaHeight + self.processingHeaderObj.firstHeight
José Chávez
voltage
r1061
George Yong
Python 2to3, Spectra (all operations) working
r1167 self.dataOut.channelList = list(range(self.systemHeaderObj.nChannels))
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.nCohInt = self.processingHeaderObj.nCohInt
José Chávez
voltage
r1061
José Chávez
formatting
r1082 # asumo q la data no esta decodificada
self.dataOut.flagDecodeData = self.processingHeaderObj.flag_decode
Daniel Valdez
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
formatting
r1082 # asumo q la data no esta sin flip
self.dataOut.flagDeflipData = self.processingHeaderObj.flag_deflip
José Chávez
voltage
r1061
Miguel Valdez
Bug fixed:...
r624 self.dataOut.flagShiftFFT = self.processingHeaderObj.shif_fft
José Chávez
voltage
r1061
Miguel Valdez
Support for VoltageReader when nTxs is >1 or <1
r748 def reshapeData(self):
José Chávez
voltage
r1061
Miguel Valdez
Support for VoltageReader when nTxs is >1 or <1
r748 if self.nTxs < 0:
return
José Chávez
voltage
r1061
Miguel Valdez
Support for VoltageReader when nTxs is >1 or <1
r748 if self.nTxs == 1:
return
José Chávez
voltage
r1061
José Chávez
formatting
r1082 if self.nTxs < 1 and self.processingHeaderObj.profilesPerBlock % (1. / self.nTxs) != 0:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("1./nTxs (=%f), should be a multiple of nProfiles (=%d)" % (
1. / self.nTxs, self.processingHeaderObj.profilesPerBlock))
José Chávez
voltage
r1061
Miguel Valdez
Support for VoltageReader when nTxs is >1 or <1
r748 if self.nTxs > 1 and self.processingHeaderObj.nHeights % self.nTxs != 0:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("nTxs (=%d), should be a multiple of nHeights (=%d)" % (
self.nTxs, self.processingHeaderObj.nHeights))
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.datablock = self.datablock.reshape(
(self.systemHeaderObj.nChannels, self.processingHeaderObj.profilesPerBlock * self.nTxs, self.processingHeaderObj.nHeights / self.nTxs))
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock * self.nTxs
self.dataOut.heightList = numpy.arange(self.processingHeaderObj.nHeights / self.nTxs) * \
self.processingHeaderObj.deltaHeight + self.processingHeaderObj.firstHeight
self.dataOut.radarControllerHeaderObj.ippSeconds = self.radarControllerHeaderObj.ippSeconds / self.nTxs
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
José Chávez
merge jroio voltage
r1056 return
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897
José Chávez
test zmq for rawdata
r975 def readFirstHeaderFromServer(self):
José Chávez
formatting
r1082
José Chávez
test zmq for rawdata
r975 self.getFirstHeader()
self.firstHeaderSize = self.basicHeaderObj.size
José Chávez
formatting
r1082 datatype = int(numpy.log2((self.processingHeaderObj.processFlags &
PROCFLAG.DATATYPE_MASK)) - numpy.log2(PROCFLAG.DATATYPE_CHAR))
José Chávez
test zmq for rawdata
r975 if datatype == 0:
José Chávez
formatting
r1082 datatype_str = numpy.dtype([('real', '<i1'), ('imag', '<i1')])
José Chávez
test zmq for rawdata
r975 elif datatype == 1:
José Chávez
formatting
r1082 datatype_str = numpy.dtype([('real', '<i2'), ('imag', '<i2')])
José Chávez
test zmq for rawdata
r975 elif datatype == 2:
José Chávez
formatting
r1082 datatype_str = numpy.dtype([('real', '<i4'), ('imag', '<i4')])
José Chávez
test zmq for rawdata
r975 elif datatype == 3:
José Chávez
formatting
r1082 datatype_str = numpy.dtype([('real', '<i8'), ('imag', '<i8')])
José Chávez
test zmq for rawdata
r975 elif datatype == 4:
José Chávez
formatting
r1082 datatype_str = numpy.dtype([('real', '<f4'), ('imag', '<f4')])
José Chávez
test zmq for rawdata
r975 elif datatype == 5:
José Chávez
formatting
r1082 datatype_str = numpy.dtype([('real', '<f8'), ('imag', '<f8')])
José Chávez
test zmq for rawdata
r975 else:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError('Data type was not defined')
José Chávez
test zmq for rawdata
r975
self.dtype = datatype_str
#self.ippSeconds = 2 * 1000 * self.radarControllerHeaderObj.ipp / self.c
José Chávez
formatting
r1082 self.fileSizeByHeader = self.processingHeaderObj.dataBlocksPerFile * self.processingHeaderObj.blockSize + \
self.firstHeaderSize + self.basicHeaderSize * \
(self.processingHeaderObj.dataBlocksPerFile - 1)
José Chávez
formatting, bug en controller.py
r1017 # self.dataOut.channelList = numpy.arange(self.systemHeaderObj.numChannels)
# self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels)
José Chávez
test zmq for rawdata
r975 self.getBlockDimension()
José Chávez
formatting
r1082 def getFromServer(self):
José Chávez
test zmq for rawdata
r975 self.flagDiscontinuousBlock = 0
self.profileIndex = 0
self.flagIsNewBlock = 1
self.dataOut.flagNoData = False
self.nTotalBlocks += 1
self.nReadBlocks += 1
self.blockPointer = 0
block = self.receiver.recv()
José Chávez
formatting, bug en controller.py
r1017
José Chávez
test zmq for rawdata
r975 self.basicHeaderObj.read(block[self.blockPointer:])
self.blockPointer += self.basicHeaderObj.length
self.systemHeaderObj.read(block[self.blockPointer:])
self.blockPointer += self.systemHeaderObj.length
self.radarControllerHeaderObj.read(block[self.blockPointer:])
self.blockPointer += self.radarControllerHeaderObj.length
self.processingHeaderObj.read(block[self.blockPointer:])
self.blockPointer += self.processingHeaderObj.length
self.readFirstHeaderFromServer()
José Chávez
formatting
r1082
José Chávez
test zmq for rawdata
r975 timestamp = self.basicHeaderObj.get_datatime()
George Yong
Python 2to3, Spectra (all operations) working
r1167 print('[Reading] - Block {} - {}'.format(self.nTotalBlocks, timestamp))
José Chávez
test zmq for rawdata
r975 current_pointer_location = self.blockPointer
José Chávez
formatting
r1082 junk = numpy.fromstring(
block[self.blockPointer:], self.dtype, self.blocksize)
José Chávez
test zmq for rawdata
r975
try:
José Chávez
formatting
r1082 junk = junk.reshape((self.processingHeaderObj.profilesPerBlock,
self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels))
José Chávez
test zmq for rawdata
r975 except:
José Chávez
formatting
r1082 # print "The read block (%3d) has not enough data" %self.nReadBlocks
José Chávez
test zmq for rawdata
r975 if self.waitDataBlock(pointer_location=current_pointer_location):
José Chávez
formatting
r1082 junk = numpy.fromstring(
block[self.blockPointer:], self.dtype, self.blocksize)
junk = junk.reshape((self.processingHeaderObj.profilesPerBlock,
self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels))
José Chávez
formatting, bug en controller.py
r1017 # return 0
José Chávez
test zmq for rawdata
r975
José Chávez
formatting
r1082 # Dimensions : nChannels, nProfiles, nSamples
José Chávez
test zmq for rawdata
r975
José Chávez
formatting
r1082 junk = numpy.transpose(junk, (2, 0, 1))
self.datablock = junk['real'] + junk['imag'] * 1j
José Chávez
test zmq for rawdata
r975 self.profileIndex = 0
José Chávez
formatting
r1082 if self.selBlocksize == None:
self.selBlocksize = self.dataOut.nProfiles
José Chávez
test zmq for rawdata
r975 if self.selBlocktime != None:
if self.dataOut.nCohInt is not None:
nCohInt = self.dataOut.nCohInt
else:
nCohInt = 1
José Chávez
formatting
r1082 self.selBlocksize = int(self.dataOut.nProfiles * round(self.selBlocktime / (
nCohInt * self.dataOut.ippSeconds * self.dataOut.nProfiles)))
self.dataOut.data = self.datablock[:,
self.profileIndex:self.profileIndex + self.selBlocksize, :]
José Chávez
test zmq for rawdata
r975 datasize = self.dataOut.data.shape[1]
if datasize < self.selBlocksize:
José Chávez
formatting
r1082 buffer = numpy.zeros(
(self.dataOut.data.shape[0], self.selBlocksize, self.dataOut.data.shape[2]), dtype='complex')
buffer[:, :datasize, :] = self.dataOut.data
José Chávez
test zmq for rawdata
r975 self.dataOut.data = buffer
self.profileIndex = blockIndex
self.dataOut.flagDataAsBlock = True
self.flagIsNewBlock = 1
self.dataOut.realtime = self.online
return self.dataOut.data
Daniel Valdez
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 getData(self):
"""
José Chávez
cambios para online offline
r1019 getData obtiene una unidad de datos del buffer de lectura, un perfil, y la copia al objeto self.dataOut
del tipo "Voltage" con todos los parametros asociados a este (metadata). cuando no hay datos
en el buffer de lectura es necesario hacer una nueva lectura de los bloques de datos usando
"readNextBlock"
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Ademas incrementa el contador del buffer "self.profileIndex" en 1.
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Return:
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Si el flag self.getByBlock ha sido seteado el bloque completo es copiado a self.dataOut y el self.profileIndex
es igual al total de perfiles leidos desde el archivo.
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Si self.getByBlock == False:
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 self.dataOut.data = buffer[:, thisProfile, :]
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 shape = [nChannels, nHeis]
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Si self.getByBlock == True:
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 self.dataOut.data = buffer[:, :, :]
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 shape = [nChannels, nProfiles, nHeis]
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Variables afectadas:
self.dataOut
self.profileIndex
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 Affected:
self.dataOut
self.profileIndex
self.flagDiscontinuousBlock
self.flagIsNewBlock
Daniel Valdez
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.flagNoMoreFiles:
self.dataOut.flagNoData = True
George Yong
Python 2to3, Spectra (all operations) working
r1167 print('Process finished')
Daniel Valdez
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 0
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.flagDiscontinuousBlock = 0
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.flagIsNewBlock = 0
if self.__hasNotDataInBuffer():
José Chávez
formatting
r1082 if not(self.readNextBlock()):
Daniel Valdez
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 0
José Chávez
voltage
r1061
Daniel Valdez
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.getFirstHeader()
José Chávez
voltage
r1061
Miguel Valdez
Support for VoltageReader when nTxs is >1 or <1
r748 self.reshapeData()
Miguel Valdez
Bug fixed: Padding decode data with zeros at the first heights was eliminated.
r611 if self.datablock 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.dataOut.flagNoData = True
return 0
José Chávez
voltage
r1061
Miguel Valdez
Affected:...
r534 if not self.getByBlock:
"""
José Chávez
cambios para online offline
r1019 Return profile by profile
If nTxs > 1 then one profile is divided by nTxs and number of total
blocks is increased by nTxs (nProfiles *= nTxs)
Miguel Valdez
Affected:...
r534 """
Miguel Valdez
Bug fixed reading voltage data by block....
r605 self.dataOut.flagDataAsBlock = False
José Chávez
formatting
r1082 self.dataOut.data = self.datablock[:, self.profileIndex, :]
Miguel Valdez
Support for VoltageReader when nTxs is >1 or <1
r748 self.dataOut.profileIndex = self.profileIndex
José Chávez
voltage
r1061
Miguel Valdez
Support for VoltageReader when nTxs is >1 or <1
r748 self.profileIndex += 1
José Chávez
formatting
r1082
José Chávez
cambios para online offline
r1019 # elif self.selBlocksize==None or self.selBlocksize==self.dataOut.nProfiles:
# """
# Return all block
# """
# self.dataOut.flagDataAsBlock = True
# self.dataOut.data = self.datablock
# self.dataOut.profileIndex = self.dataOut.nProfiles - 1
José Chávez
formatting
r1082 #
José Chávez
cambios para online offline
r1019 # self.profileIndex = self.dataOut.nProfiles
José Chávez
formatting
r1082
Miguel Valdez
Affected:...
r534 else:
"""
José Chávez
cambios para online offline
r1019 Return a block
Miguel Valdez
Affected:...
r534 """
José Chávez
formatting
r1082 if self.selBlocksize == None:
self.selBlocksize = self.dataOut.nProfiles
Julio Valdez
Correction to jroIO_voltage when reading by block
r849 if self.selBlocktime != None:
if self.dataOut.nCohInt is not None:
nCohInt = self.dataOut.nCohInt
else:
José Chávez
voltage
r1061 nCohInt = 1
José Chávez
formatting
r1082 self.selBlocksize = int(self.dataOut.nProfiles * round(self.selBlocktime / (
nCohInt * self.dataOut.ippSeconds * self.dataOut.nProfiles)))
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.dataOut.data = self.datablock[:,
self.profileIndex:self.profileIndex + self.selBlocksize, :]
Julio Valdez
New reading option allows to read by blocks of different sizes
r833 self.profileIndex += self.selBlocksize
Julio Valdez
voltage reader enhancements
r834 datasize = self.dataOut.data.shape[1]
José Chávez
voltage
r1061
if datasize < self.selBlocksize:
José Chávez
formatting
r1082 buffer = numpy.zeros(
(self.dataOut.data.shape[0], self.selBlocksize, self.dataOut.data.shape[2]), dtype='complex')
buffer[:, :datasize, :] = self.dataOut.data
José Chávez
voltage
r1061
José Chávez
formatting
r1082 while datasize < self.selBlocksize: # Not enough profiles to fill the block
if not(self.readNextBlock()):
José Chávez
voltage
r1061 return 0
Julio Valdez
voltage reader enhancements
r834 self.getFirstHeader()
self.reshapeData()
if self.datablock is None:
self.dataOut.flagNoData = True
return 0
José Chávez
formatting
r1082 # stack data
Julio Valdez
voltage reader enhancements
r834 blockIndex = self.selBlocksize - datasize
José Chávez
formatting
r1082 datablock1 = self.datablock[:, :blockIndex, :]
José Chávez
voltage
r1061
José Chávez
formatting
r1082 buffer[:, datasize:datasize +
datablock1.shape[1], :] = datablock1
Julio Valdez
voltage reader enhancements
r834 datasize += datablock1.shape[1]
José Chávez
voltage
r1061
Julio Valdez
voltage reader enhancements
r834 self.dataOut.data = buffer
self.profileIndex = blockIndex
Julio Valdez
New reading option allows to read by blocks of different sizes
r833 self.dataOut.flagDataAsBlock = True
Julio Valdez
-Function to interpolate corrupted profiles
r836 self.dataOut.nProfiles = self.dataOut.data.shape[1]
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.flagNoData = False
José Chávez
voltage
r1061
Daniel Valdez
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.getBasicHeader()
José Chávez
voltage
r1061
Daniel Valdez
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.realtime = self.online
José Chávez
voltage
r1061
Daniel Valdez
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.dataOut.data
José Chávez
formatting
r1082
Daniel Valdez
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 VoltageWriter(JRODataWriter, Operation):
José Chávez
voltage
r1061 """
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Esta clase permite escribir datos de voltajes a archivos procesados (.r). La escritura
José Chávez
voltage
r1061 de los datos siempre se realiza por bloques.
Daniel Valdez
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
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ext = ".r"
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 optchar = "D"
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 shapeBuffer = None
José Chávez
voltage
r1061 def __init__(self, **kwargs):
"""
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Inicializador de la clase VoltageWriter para la escritura de datos de espectros.
José Chávez
voltage
r1061
Affected:
Daniel Valdez
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
Return: None
"""
José Chávez
voltage
r1061 Operation.__init__(self, **kwargs)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.nTotalBlocks = 0
self.profileIndex = 0
José Chávez
voltage
r1061
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.isConfig = False
José Chávez
voltage
r1061
Daniel Valdez
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.fp = None
self.flagIsNewFile = 1
José Chávez
voltage
r1061
self.blockIndex = 0
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.flagIsNewBlock = 0
self.setFile = None
José Chávez
voltage
r1061
Daniel Valdez
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.dtype = None
José Chávez
voltage
r1061
Daniel Valdez
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.path = None
José Chávez
voltage
r1061
Daniel Valdez
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.filename = None
José Chávez
voltage
r1061
Daniel Valdez
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.basicHeaderObj = BasicHeader(LOCALTIME)
José Chávez
voltage
r1061
Daniel Valdez
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.systemHeaderObj = SystemHeader()
José Chávez
voltage
r1061
Daniel Valdez
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.radarControllerHeaderObj = RadarControllerHeader()
José Chávez
voltage
r1061
Daniel Valdez
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.processingHeaderObj = ProcessingHeader()
def hasAllDataInBuffer(self):
if self.profileIndex >= self.processingHeaderObj.profilesPerBlock:
return 1
return 0
def setBlockDimension(self):
"""
Obtiene las formas dimensionales del los subbloques de datos que componen un bloque
Affected:
self.shape_spc_Buffer
self.shape_cspc_Buffer
self.shape_dc_Buffer
Return: None
"""
self.shapeBuffer = (self.processingHeaderObj.profilesPerBlock,
self.processingHeaderObj.nHeights,
self.systemHeaderObj.nChannels)
José Chávez
voltage
r1061
Daniel Valdez
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.datablock = numpy.zeros((self.systemHeaderObj.nChannels,
José Chávez
formatting
r1082 self.processingHeaderObj.profilesPerBlock,
self.processingHeaderObj.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 dtype=numpy.dtype('complex64'))
José Chávez
voltage
r1061
Daniel Valdez
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 writeBlock(self):
"""
Escribe el buffer en el file designado
José Chávez
voltage
r1061
Daniel Valdez
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
voltage
r1061 self.profileIndex
Daniel Valdez
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.flagIsNewFile
self.flagIsNewBlock
self.nTotalBlocks
José Chávez
voltage
r1061 self.blockIndex
Daniel Valdez
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
"""
José Chávez
formatting
r1082 data = numpy.zeros(self.shapeBuffer, self.dtype)
José Chávez
voltage
r1061
José Chávez
formatting
r1082 junk = numpy.transpose(self.datablock, (1, 2, 0))
José Chávez
voltage
r1061
Daniel Valdez
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['real'] = junk.real
data['imag'] = junk.imag
José Chávez
voltage
r1061
José Chávez
formatting
r1082 data = data.reshape((-1))
José Chávez
voltage
r1061
José Chávez
formatting
r1082 data.tofile(self.fp)
José Chávez
voltage
r1061
Daniel Valdez
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.datablock.fill(0)
José Chávez
voltage
r1061
self.profileIndex = 0
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.flagIsNewFile = 0
self.flagIsNewBlock = 1
José Chávez
voltage
r1061
Daniel Valdez
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.blockIndex += 1
self.nTotalBlocks += 1
José Chávez
voltage
r1061
Miguel Valdez
minor changes: ...
r585 # print "[Writing] Block = %04d" %self.blockIndex
José Chávez
voltage
r1061
Daniel Valdez
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):
"""
José Chávez
voltage
r1061 Setea un bloque de datos y luego los escribe en un file
Daniel Valdez
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.flagIsNewBlock
self.profileIndex
José Chávez
voltage
r1061 Return:
0 : Si no hay data o no hay mas files que puedan escribirse
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 1 : Si se escribio la data de un bloque en un file
"""
if self.dataOut.flagNoData:
return 0
José Chávez
voltage
r1061
Daniel Valdez
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.flagIsNewBlock = 0
José Chávez
voltage
r1061
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 if self.dataOut.flagDiscontinuousBlock:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.datablock.fill(0)
self.profileIndex = 0
self.setNextFile()
José Chávez
voltage
r1061
Daniel Valdez
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.profileIndex == 0:
self.setBasicHeader()
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.datablock[:, self.profileIndex, :] = self.dataOut.data
José Chávez
voltage
r1061
Daniel Valdez
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 += 1
José Chávez
voltage
r1061
Daniel Valdez
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.hasAllDataInBuffer():
José Chávez
formatting
r1082 # if self.flagIsNewFile:
Daniel Valdez
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.writeNextBlock()
# self.setFirstHeader()
José Chávez
voltage
r1061
Daniel Valdez
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
voltage
r1061
Daniel Valdez
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 __getBlockSize(self):
'''
Este metodos determina el cantidad de bytes para un bloque de datos de tipo Voltage
'''
José Chávez
voltage
r1061
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 dtype_width = self.getDtypeWidth()
José Chávez
voltage
r1061
José Chávez
formatting
r1082 blocksize = int(self.dataOut.nHeights * self.dataOut.nChannels *
self.profilesPerBlock * dtype_width * 2)
José Chávez
voltage
r1061
Daniel Valdez
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 blocksize
José Chávez
voltage
r1061
Daniel Valdez
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 setFirstHeader(self):
"""
Obtiene una copia del First Header
José Chávez
voltage
r1061
Daniel Valdez
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.systemHeaderObj
self.radarControllerHeaderObj
self.dtype
José Chávez
voltage
r1061 Return:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 None
"""
José Chávez
voltage
r1061
Daniel Valdez
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.systemHeaderObj = self.dataOut.systemHeaderObj.copy()
self.systemHeaderObj.nChannels = self.dataOut.nChannels
self.radarControllerHeaderObj = self.dataOut.radarControllerHeaderObj.copy()
José Chávez
voltage
r1061
José Chávez
formatting
r1082 self.processingHeaderObj.dtype = 0 # Voltage
Daniel Valdez
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.processingHeaderObj.blockSize = self.__getBlockSize()
self.processingHeaderObj.profilesPerBlock = self.profilesPerBlock
self.processingHeaderObj.dataBlocksPerFile = self.blocksPerFile
José Chávez
formatting
r1082 # podria ser 1 o self.dataOut.processingHeaderObj.nWindows
self.processingHeaderObj.nWindows = 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 self.processingHeaderObj.nCohInt = self.dataOut.nCohInt
José Chávez
formatting
r1082 # Cuando la data de origen es de tipo Voltage
self.processingHeaderObj.nIncohInt = 1
# Cuando la data de origen es de tipo Voltage
self.processingHeaderObj.totalSpectra = 0
José Chávez
voltage
r1061
Miguel Valdez
Bug fixed:...
r624 if self.dataOut.code is not None:
self.processingHeaderObj.code = self.dataOut.code
self.processingHeaderObj.nCode = self.dataOut.nCode
self.processingHeaderObj.nBaud = self.dataOut.nBaud
José Chávez
voltage
r1061
Daniel Valdez
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.processingHeaderObj.nWindows != 0:
self.processingHeaderObj.firstHeight = self.dataOut.heightList[0]
José Chávez
formatting
r1082 self.processingHeaderObj.deltaHeight = self.dataOut.heightList[1] - \
self.dataOut.heightList[0]
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.processingHeaderObj.nHeights = self.dataOut.nHeights
self.processingHeaderObj.samplesWin = self.dataOut.nHeights
José Chávez
voltage
r1061
Miguel Valdez
Bug fixed:...
r624 self.processingHeaderObj.processFlags = self.getProcessFlags()
José Chávez
voltage
r1061
George Yong
Multiprocessing for voltage (all operations) working
r1173 self.setBasicHeader()