##// END OF EJS Templates
Se realizar la lectura en modo online llamando al metodo digitalRFReader(self.path) en reemplazo del metodo reload(), grabando previamente el path de lectura o directorio superior donde se almacena la data. Adicionalmente, se ha definido un tiempo de espera de 3 segundos para dar tiempo suficiente al programa de adquisicion de generar archivos. ...
Se realizar la lectura en modo online llamando al metodo digitalRFReader(self.path) en reemplazo del metodo reload(), grabando previamente el path de lectura o directorio superior donde se almacena la data. Adicionalmente, se ha definido un tiempo de espera de 3 segundos para dar tiempo suficiente al programa de adquisicion de generar archivos. El archivo jroIO_digitalRF.py utiliza la libreria digital_rf cuya version actual es la 2.62( 2017 ) ,esta libreria no tiene definido el metodo o clase reload, este metodo existe en la version 2.0(2014), si uno revisa el archivo jroIO_usrp.py, esta unidad de lectura trabaja con la version 2.0 llamada digital_rf_hdf5, para hacer uso de esta unidad de lectura se instalan los programas correspondiente pero el formato y la informacion difiere un poco de la version actual. Se infiere entonces que al desarrollar del archivo jroIO_digitalRF.py, esperaba que la libreria aun tenga incluido el metodo reload con el update de las versiones pero este ya no es parte del desarrollo, Se realizo la consulta al desarrollador actual de digitalRF Ryan Voltz si se iba a incluir a futuro pero indico que no era necesario.

File last commit:

r1080:af3edc5dd0e9
r1234:b6a76136b1f3
Show More
jroproc_amisr.py
142 lines | 4.3 KiB | text/x-python | PythonLexer
'''
@author: Daniel Suarez
'''
import numpy
from jroproc_base import ProcessingUnit, Operation
from schainpy.model.data.jroamisr import AMISR
class AMISRProc(ProcessingUnit):
def __init__(self, **kwargs):
ProcessingUnit.__init__(self, **kwargs)
self.objectDict = {}
self.dataOut = AMISR()
def run(self):
if self.dataIn.type == 'AMISR':
self.dataOut.copy(self.dataIn)
class PrintInfo(Operation):
def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
self.__isPrinted = False
def run(self, dataOut):
if not self.__isPrinted:
print 'Number of Records by File: %d'%dataOut.nRecords
print 'Number of Pulses: %d'%dataOut.nProfiles
print 'Number of Pulses by Frame: %d'%dataOut.npulseByFrame
print 'Number of Samples by Pulse: %d'%len(dataOut.heightList)
print 'Ipp Seconds: %f'%dataOut.ippSeconds
print 'Number of Beams: %d'%dataOut.nBeams
print 'BeamCodes:'
beamStrList = ['Beam %d -> Code=%d, azimuth=%2.2f, zenith=%2.2f, gain=%2.2f'%(k,v[0],v[1],v[2],v[3]) for k,v in dataOut.beamCodeDict.items()]
for b in beamStrList:
print b
self.__isPrinted = True
return
class BeamSelector(Operation):
profileIndex = None
nProfiles = None
def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
self.profileIndex = 0
self.__isConfig = False
def incIndex(self):
self.profileIndex += 1
if self.profileIndex >= self.nProfiles:
self.profileIndex = 0
def isProfileInRange(self, minIndex, maxIndex):
if self.profileIndex < minIndex:
return False
if self.profileIndex > maxIndex:
return False
return True
def isProfileInList(self, profileList):
if self.profileIndex not in profileList:
return False
return True
def run(self, dataOut, beam=None):
dataOut.flagNoData = True
if not(self.__isConfig):
self.nProfiles = dataOut.nProfiles
self.profileIndex = dataOut.profileIndex
self.__isConfig = True
if beam != None:
if self.isProfileInList(dataOut.beamRangeDict[beam]):
beamInfo = dataOut.beamCodeDict[beam]
dataOut.azimuth = beamInfo[1]
dataOut.zenith = beamInfo[2]
dataOut.gain = beamInfo[3]
dataOut.flagNoData = False
self.incIndex()
return 1
else:
raise ValueError, "BeamSelector needs beam value"
return 0
class ProfileToChannels(Operation):
def __init__(self, **kwargs):
Operation.__init__(self, **kwargs)
self.__isConfig = False
self.__counter_chan = 0
self.buffer = None
def isProfileInList(self, profileList):
if self.profileIndex not in profileList:
return False
return True
def run(self, dataOut):
dataOut.flagNoData = True
if not(self.__isConfig):
nchannels = len(dataOut.beamRangeDict.keys())
nsamples = dataOut.nHeights
self.buffer = numpy.zeros((nchannels, nsamples), dtype = 'complex128')
dataOut.beam.codeList = [dataOut.beamCodeDict[x][0] for x in range(nchannels)]
dataOut.beam.azimuthList = [dataOut.beamCodeDict[x][1] for x in range(nchannels)]
dataOut.beam.zenithList = [dataOut.beamCodeDict[x][2] for x in range(nchannels)]
self.__isConfig = True
for i in range(self.buffer.shape[0]):
if dataOut.profileIndex in dataOut.beamRangeDict[i]:
self.buffer[i,:] = dataOut.data
break
self.__counter_chan += 1
if self.__counter_chan >= self.buffer.shape[0]:
self.__counter_chan = 0
dataOut.data = self.buffer.copy()
dataOut.channelList = range(self.buffer.shape[0])
self.__isConfig = False
dataOut.flagNoData = False
pass