##// 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:

r568:486c66596e4c
r1234:b6a76136b1f3
Show More
testServer.py
176 lines | 3.4 KiB | text/x-python | PythonLexer
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 '''
Created on Jul 15, 2014
@author: roj-idl71
'''
import sys
import yaml
import numpy
import jsonpickle
# import schainpy.serializer.DynamicSerializer as DynamicSerializer
def isNotClassVar(myObj):
return not hasattr(myObj,'__dict__')
def isDictFormat(thisValue):
if type(thisValue) != type({}):
return False
if '__name__' not in thisValue.keys():
return False
return True
def obj2Dict(myObj):
myDict = {}
myDict['__name__'] = myObj.__class__.__name__
for thisKey, thisValue in myObj.__dict__.items():
if isNotClassVar(thisValue):
myDict[thisKey] = thisValue
continue
## If this value is another class instance
myNewDict = obj2Dict(thisValue)
myDict[thisKey] = myNewDict
return myDict
def dict2Obj(myDict):
'''
'''
if '__name__' not in myDict.keys():
return None
className = eval(myDict['__name__'])
myObj = className()
for thisKey, thisValue in myDict.items():
if thisKey == '__name__':
continue
if not isDictFormat(thisValue):
setattr(myObj, thisKey, thisValue)
continue
myNewObj = dict2Obj(thisValue)
setattr(myObj, thisKey, myNewObj)
return myObj
class myTestClass3(object):
def __init__(self):
'''
'''
self.y1 = 'y1'
self.y2 = 'y2'
class myTestClass2(object):
def __init__(self):
'''
'''
self.x1 = 'x1'
self.x2 = 'x2'
self.otherObj = myTestClass3()
class myTestClass(object):
flagNoData = True
value1 = 1
value2 = 2
myObj = None
def __init__(self):
'''
'''
self.flagNoData = True
self.value1 = 1
self.value2 = 2
self.myObj = myTestClass2()
def get_dtype(self):
'''
'''
return self.value1
def set_dtype(self, value):
'''
'''
self.value1 = value
dtype = property(get_dtype, set_dtype)
def myMsgPackTest():
import msgpack
import msgpack_numpy as m
import numpy as np
x = np.random.rand(5)
x_enc = m.encode(x)
x_rec = m.decode(x_enc)
print x_rec
#
# x_enc = msgpack.packb(x, default=m.encoder)
# x_rec = msgpack.unpackb(x_enc, object_hook=m.decoder)
if __name__ == '__main__':
myMsgPackTest()
sys.exit()
serializerObj = DynamicSerializer.DynamicSerializer('json')
serializerObj = jsonpickle
myTestObj = myTestClass()
myTestObj.flagNoData = False
myTestObj.value1 = [1+3.4j,4,'5',]
myTestObj.value2 = {'x2': numpy.complex(1,2),'x1': 'x1'}
# myTestObj.myObj.x2 = numpy.arange(15, dtype=numpy.complex)
myDict = obj2Dict(myTestObj)
myNewObj = dict2Obj(myDict)
# print myDict
# print myTestObj.__dict__
# print myNewObj.__dict__
# sys.exit()
print myDict
newSerial = serializerObj.encode(myDict)
# print newSerial
newDict = serializerObj.decode(newSerial)
print newDict
myNewObj = dict2Obj(newDict)
print
print
print 50*'###'
print myTestObj.__dict__
print myNewObj.__dict__