##// END OF EJS Templates
Python 2to3, Spectra (all operations) working
Python 2to3, Spectra (all operations) working

File last commit:

r1167:1f521b07c958
r1167:1f521b07c958
Show More
jroheaderIO.py
906 lines | 28.5 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 '''
$Author: murco $
$Id: JROHeaderIO.py 151 2012-10-31 19:00:51Z murco $
'''
Ivan Valdez
Bug fixed in jroheaderIO. Importing sys
r798 import sys
Daniel Valdez
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
import copy
import datetime
Jose Chavez
agregado metodos a header class
r980 import inspect
George Yong
Python 2to3, Spectra (all operations) working
r1167 from schainpy.utils import log
Daniel Valdez
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
Bug fixed: error calculating size of RC Header. ...
r616 SPEED_OF_LIGHT = 299792458
SPEED_OF_LIGHT = 3e8
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 BASIC_STRUCTURE = numpy.dtype([
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 ('nSize', '<u4'),
('nVersion', '<u2'),
('nDataBlockId', '<u4'),
('nUtime', '<u4'),
('nMilsec', '<u2'),
('nTimezone', '<i2'),
('nDstflag', '<i2'),
('nErrorCount', '<u4')
])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
SYSTEM_STRUCTURE = numpy.dtype([
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 ('nSize', '<u4'),
('nNumSamples', '<u4'),
('nNumProfiles', '<u4'),
('nNumChannels', '<u4'),
('nADCResolution', '<u4'),
('nPCDIOBusWidth', '<u4'),
])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
RADAR_STRUCTURE = numpy.dtype([
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 ('nSize', '<u4'),
('nExpType', '<u4'),
('nNTx', '<u4'),
('fIpp', '<f4'),
('fTxA', '<f4'),
('fTxB', '<f4'),
('nNumWindows', '<u4'),
('nNumTaus', '<u4'),
('nCodeType', '<u4'),
('nLine6Function', '<u4'),
('nLine5Function', '<u4'),
('fClock', '<f4'),
('nPrePulseBefore', '<u4'),
('nPrePulseAfter', '<u4'),
('sRangeIPP', '<a20'),
('sRangeTxA', '<a20'),
('sRangeTxB', '<a20'),
])
SAMPLING_STRUCTURE = numpy.dtype(
[('h0', '<f4'), ('dh', '<f4'), ('nsa', '<u4')])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
PROCESSING_STRUCTURE = numpy.dtype([
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 ('nSize', '<u4'),
('nDataType', '<u4'),
('nSizeOfDataBlock', '<u4'),
('nProfilesperBlock', '<u4'),
('nDataBlocksperFile', '<u4'),
('nNumWindows', '<u4'),
('nProcessFlags', '<u4'),
('nCoherentIntegrations', '<u4'),
('nIncoherentIntegrations', '<u4'),
('nTotalSpectra', '<u4')
])
Daniel Valdez
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 Header(object):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 __init__(self):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 copy(self):
return copy.deepcopy(self)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 read(self):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 write(self):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Jose Chavez
agregado metodos a header class
r980
def getAllowedArgs(self):
Jose Chavez
setting all headers all the time
r981 args = inspect.getargspec(self.__init__).args
try:
args.remove('self')
except:
pass
return args
def getAsDict(self):
args = self.getAllowedArgs()
asDict = {}
for x in args:
asDict[x] = self[x]
return asDict
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Jose Chavez
setting all headers all the time
r981 def __getitem__(self, name):
return getattr(self, name)
Daniel Valdez
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 printInfo(self):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
message = "#" * 50 + "\n"
Miguel Valdez
Version: 2.1.3.2...
r672 message += self.__class__.__name__.upper() + "\n"
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 message += "#" * 50 + "\n"
George Yong
Python 2to3, Spectra (all operations) working
r1167 keyList = list(self.__dict__.keys())
Miguel Valdez
Problems setting and reading Header size
r728 keyList.sort()
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Problems setting and reading Header size
r728 for key in keyList:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 message += "%s = %s" % (key, self.__dict__[key]) + "\n"
Miguel Valdez
Problems setting and reading Header size
r728 if "size" not in keyList:
attr = getattr(self, "size")
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Problems setting and reading Header size
r728 if attr:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 message += "%s = %s" % ("size", attr) + "\n"
George Yong
Python 2to3, Spectra (all operations) working
r1167 print(message)
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 BasicHeader(Header):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 size = None
version = None
dataBlock = None
utc = None
ltc = None
miliSecond = None
timeZone = None
dstFlag = None
errorCount = None
datatime = None
Jose Chavez
agregado metodos a header class
r980 structure = BASIC_STRUCTURE
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 __LOCALTIME = None
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 __init__(self, useLocalTime=True):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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.size = 24
self.version = 0
self.dataBlock = 0
self.utc = 0
self.miliSecond = 0
self.timeZone = 0
self.dstFlag = 0
self.errorCount = 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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.useLocalTime = useLocalTime
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 read(self, fp):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 self.length = 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 try:
José Chávez
pruebas jrovoltage
r963 if hasattr(fp, 'read'):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 header = numpy.fromfile(fp, BASIC_STRUCTURE, 1)
José Chávez
pruebas jrovoltage
r963 else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 header = numpy.fromstring(fp, BASIC_STRUCTURE, 1)
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("BasicHeader: ")
print(e)
Daniel Valdez
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
test zmq for rawdata
r975
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 self.size = int(header['nSize'][0])
self.version = int(header['nVersion'][0])
self.dataBlock = int(header['nDataBlockId'][0])
self.utc = int(header['nUtime'][0])
self.miliSecond = int(header['nMilsec'][0])
self.timeZone = int(header['nTimezone'][0])
self.dstFlag = int(header['nDstflag'][0])
self.errorCount = int(header['nErrorCount'][0])
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
r803 if self.size < 24:
return 0
José Chávez
test zmq for rawdata
r975
self.length = header.nbytes
Daniel Valdez
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
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 write(self, fp):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
headerTuple = (self.size, self.version, self.dataBlock, self.utc,
self.miliSecond, self.timeZone, self.dstFlag, self.errorCount)
header = numpy.array(headerTuple, BASIC_STRUCTURE)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 header.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 get_ltc(self):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
return self.utc - self.timeZone * 60
Daniel Valdez
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 set_ltc(self, value):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
self.utc = value + self.timeZone * 60
Daniel Valdez
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 get_datatime(self):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 datetime.datetime.utcfromtimestamp(self.ltc)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ltc = property(get_ltc, set_ltc)
datatime = property(get_datatime)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 SystemHeader(Header):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 size = None
nSamples = None
nProfiles = None
nChannels = None
adcResolution = None
pciDioBusWidth = None
Jose Chavez
agregado metodos a header class
r980 structure = SYSTEM_STRUCTURE
Jose Chavez
setting all headers all the time
r981 def __init__(self, nSamples=0, nProfiles=0, nChannels=0, adcResolution=14, pciDioBusWidth=0):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
self.size = 24
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.nSamples = nSamples
self.nProfiles = nProfiles
self.nChannels = nChannels
self.adcResolution = adcResolution
Jose Chavez
setting all headers all the time
r981 self.pciDioBusWidth = pciDioBusWidth
Jose Chavez
agregado metodos a header class
r980
Daniel Valdez
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 read(self, fp):
José Chávez
test zmq for rawdata
r975 self.length = 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 try:
José Chávez
test zmq for rawdata
r975 startFp = fp.tell()
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
José Chávez
test zmq for rawdata
r975 startFp = None
pass
try:
if hasattr(fp, 'read'):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 header = numpy.fromfile(fp, SYSTEM_STRUCTURE, 1)
José Chávez
test zmq for rawdata
r975 else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 header = numpy.fromstring(fp, SYSTEM_STRUCTURE, 1)
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("System Header: " + str(e))
Daniel Valdez
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
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 self.size = header['nSize'][0]
self.nSamples = header['nNumSamples'][0]
self.nProfiles = header['nNumProfiles'][0]
self.nChannels = header['nNumChannels'][0]
self.adcResolution = header['nADCResolution'][0]
self.pciDioBusWidth = header['nPCDIOBusWidth'][0]
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 if startFp is not None:
endFp = self.size + startFp
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 if fp.tell() > endFp:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 sys.stderr.write(
"Warning %s: Size value read from System Header is lower than it has to be\n" % fp.name)
José Chávez
test zmq for rawdata
r975 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 if fp.tell() < endFp:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 sys.stderr.write(
"Warning %s: Size value read from System Header size is greater than it has to be\n" % fp.name)
José Chávez
test zmq for rawdata
r975 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 self.length = header.nbytes
Daniel Valdez
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
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 write(self, fp):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
headerTuple = (self.size, self.nSamples, self.nProfiles,
self.nChannels, self.adcResolution, self.pciDioBusWidth)
header = numpy.array(headerTuple, SYSTEM_STRUCTURE)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 header.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 RadarControllerHeader(Header):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 expType = None
nTx = None
ipp = None
txA = None
txB = None
nWindows = None
numTaus = None
codeType = None
line6Function = None
line5Function = None
fClock = None
prePulseBefore = None
Jose Chavez
setting all headers all the time
r981 prePulseAfter = 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 rangeIpp = None
rangeTxA = None
rangeTxB = None
Jose Chavez
agregado metodos a header class
r980 structure = RADAR_STRUCTURE
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 __size = None
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 def __init__(self, expType=2, nTx=1,
Jose Chavez
setting all headers all the time
r981 ipp=None, txA=0, txB=0,
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 nWindows=None, nHeights=None, firstHeight=None, deltaHeight=None,
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 numTaus=0, line6Function=0, line5Function=0, fClock=None,
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 prePulseBefore=0, prePulseAfter=0,
codeType=0, nCode=0, nBaud=0, code=None,
flip1=0, flip2=0):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
# self.size = 116
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.expType = expType
self.nTx = nTx
Jose Chavez
setting all headers all the time
r981 self.ipp = ipp
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.txA = txA
self.txB = txB
Jose Chavez
setting all headers all the time
r981 self.rangeIpp = ipp
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.rangeTxA = txA
self.rangeTxB = txB
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.nWindows = nWindows
self.numTaus = numTaus
self.codeType = codeType
self.line6Function = line6Function
self.line5Function = line5Function
self.fClock = fClock
self.prePulseBefore = prePulseBefore
Jose Chavez
setting all headers all the time
r981 self.prePulseAfter = prePulseAfter
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.nHeights = nHeights
self.firstHeight = firstHeight
self.deltaHeight = deltaHeight
self.samplesWin = nHeights
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.nCode = nCode
self.nBaud = nBaud
self.code = code
self.flip1 = flip1
self.flip2 = flip2
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
self.code_size = int(numpy.ceil(self.nBaud / 32.)) * self.nCode * 4
Daniel Valdez
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.dynamic = numpy.array([],numpy.dtype('byte'))
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if self.fClock is None and self.deltaHeight is not None:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 self.fClock = 0.15 / (deltaHeight * 1e-6) # 0.15Km / (height * 1u)
Daniel Valdez
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 read(self, fp):
José Chávez
test zmq for rawdata
r975 self.length = 0
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 try:
José Chávez
test zmq for rawdata
r975 startFp = fp.tell()
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
José Chávez
test zmq for rawdata
r975 startFp = None
pass
try:
if hasattr(fp, 'read'):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 header = numpy.fromfile(fp, RADAR_STRUCTURE, 1)
José Chávez
test zmq for rawdata
r975 else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 header = numpy.fromstring(fp, RADAR_STRUCTURE, 1)
José Chávez
test zmq for rawdata
r975 self.length += header.nbytes
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("RadarControllerHeader: " + str(e))
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 size = int(header['nSize'][0])
self.expType = int(header['nExpType'][0])
self.nTx = int(header['nNTx'][0])
self.ipp = float(header['fIpp'][0])
self.txA = float(header['fTxA'][0])
self.txB = float(header['fTxB'][0])
self.nWindows = int(header['nNumWindows'][0])
self.numTaus = int(header['nNumTaus'][0])
self.codeType = int(header['nCodeType'][0])
self.line6Function = int(header['nLine6Function'][0])
self.line5Function = int(header['nLine5Function'][0])
self.fClock = float(header['fClock'][0])
self.prePulseBefore = int(header['nPrePulseBefore'][0])
Jose Chavez
setting all headers all the time
r981 self.prePulseAfter = int(header['nPrePulseAfter'][0])
Miguel Valdez
Bug fixed:...
r624 self.rangeIpp = header['sRangeIPP'][0]
self.rangeTxA = header['sRangeTxA'][0]
self.rangeTxB = header['sRangeTxB'][0]
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 try:
if hasattr(fp, 'read'):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 samplingWindow = numpy.fromfile(
fp, SAMPLING_STRUCTURE, self.nWindows)
José Chávez
test zmq for rawdata
r975 else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 samplingWindow = numpy.fromstring(
fp[self.length:], SAMPLING_STRUCTURE, self.nWindows)
José Chávez
test zmq for rawdata
r975 self.length += samplingWindow.nbytes
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("RadarControllerHeader: " + str(e))
José Chávez
test zmq for rawdata
r975 return 0
Miguel Valdez
Bug fixed:...
r624 self.nHeights = int(numpy.sum(samplingWindow['nsa']))
self.firstHeight = samplingWindow['h0']
self.deltaHeight = samplingWindow['dh']
self.samplesWin = samplingWindow['nsa']
José Chávez
test zmq for rawdata
r975
try:
if hasattr(fp, 'read'):
self.Taus = numpy.fromfile(fp, '<f4', self.numTaus)
else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 self.Taus = numpy.fromstring(
fp[self.length:], '<f4', self.numTaus)
José Chávez
test zmq for rawdata
r975 self.length += self.Taus.nbytes
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("RadarControllerHeader: " + str(e))
José Chávez
test zmq for rawdata
r975 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 self.code_size = 0
if self.codeType != 0:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 try:
if hasattr(fp, 'read'):
José Chávez
fix meteors processing bugs
r992 self.nCode = numpy.fromfile(fp, '<u4', 1)[0]
José Chávez
test zmq for rawdata
r975 self.length += self.nCode.nbytes
José Chávez
fix meteors processing bugs
r992 self.nBaud = numpy.fromfile(fp, '<u4', 1)[0]
José Chávez
test zmq for rawdata
r975 self.length += self.nBaud.nbytes
else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 self.nCode = numpy.fromstring(
fp[self.length:], '<u4', 1)[0]
José Chávez
test zmq for rawdata
r975 self.length += self.nCode.nbytes
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 self.nBaud = numpy.fromstring(
fp[self.length:], '<u4', 1)[0]
José Chávez
test zmq for rawdata
r975 self.length += self.nBaud.nbytes
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("RadarControllerHeader: " + str(e))
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 return 0
code = numpy.empty([self.nCode, self.nBaud], dtype='i1')
Miguel Valdez
Bug fixed:...
r624 for ic in range(self.nCode):
José Chávez
test zmq for rawdata
r975 try:
if hasattr(fp, 'read'):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 temp = numpy.fromfile(fp, 'u4', int(
numpy.ceil(self.nBaud / 32.)))
José Chávez
test zmq for rawdata
r975 else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 temp = numpy.fromstring(
fp, 'u4', int(numpy.ceil(self.nBaud / 32.)))
José Chávez
test zmq for rawdata
r975 self.length += temp.nbytes
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("RadarControllerHeader: " + str(e))
José Chávez
test zmq for rawdata
r975 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 for ib in range(self.nBaud - 1, -1, -1):
George Yong
Python 2to3, Spectra (all operations) working
r1167 log.error(ib / 32)
code[ic, ib] = temp[int(ib / 32)] % 2
temp[int(ib / 32)] = temp[int(ib / 32)] / 2
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
self.code = 2.0 * code - 1.0
self.code_size = int(numpy.ceil(self.nBaud / 32.)) * self.nCode * 4
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 # if self.line5Function == RCfunction.FLIP:
# self.flip1 = numpy.fromfile(fp,'<u4',1)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 #
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 # if self.line6Function == RCfunction.FLIP:
# self.flip2 = numpy.fromfile(fp,'<u4',1)
José Chávez
test zmq for rawdata
r975 if startFp is not None:
endFp = size + startFp
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 if fp.tell() != endFp:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 # fp.seek(endFp)
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("%s: Radar Controller Header size is not consistent: from data [%d] != from header field [%d]" % (fp.name, fp.tell() - startFp, size))
José Chávez
test zmq for rawdata
r975 # return 0
if fp.tell() > endFp:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 sys.stderr.write(
"Warning %s: Size value read from Radar Controller header is lower than it has to be\n" % fp.name)
José Chávez
test zmq for rawdata
r975 # return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 if fp.tell() < endFp:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 sys.stderr.write(
"Warning %s: Size value read from Radar Controller header is greater than it has to be\n" % fp.name)
Daniel Valdez
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
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 write(self, fp):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 headerTuple = (self.size,
self.expType,
self.nTx,
self.ipp,
self.txA,
self.txB,
self.nWindows,
self.numTaus,
self.codeType,
self.line6Function,
self.line5Function,
self.fClock,
self.prePulseBefore,
Jose Chavez
setting all headers all the time
r981 self.prePulseAfter,
Daniel Valdez
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.rangeIpp,
self.rangeTxA,
self.rangeTxB)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
header = numpy.array(headerTuple, RADAR_STRUCTURE)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 header.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
sampleWindowTuple = (
self.firstHeight, self.deltaHeight, self.samplesWin)
samplingWindow = numpy.array(sampleWindowTuple, SAMPLING_STRUCTURE)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 samplingWindow.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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.numTaus > 0:
self.Taus.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
if self.codeType != 0:
Alexander Valdez
Encontre un bug durante la escritura de datos en este archivo....
r556 nCode = numpy.array(self.nCode, '<u4')
nCode.tofile(fp)
nBaud = numpy.array(self.nBaud, '<u4')
nBaud.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 code1 = (self.code + 1.0) / 2.
Alexander Valdez
Encontre un bug durante la escritura de datos en este archivo....
r556 for ic in range(self.nCode):
José Chávez
merge 2.3
r1125 tempx = numpy.zeros(int(numpy.ceil(self.nBaud / 32.)))
Alexander Valdez
Encontre un bug durante la escritura de datos en este archivo....
r556 start = 0
end = 32
for i in range(len(tempx)):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 code_selected = code1[ic, start:end]
for j in range(len(code_selected) - 1, -1, -1):
Alexander Valdez
Encontre un bug durante la escritura de datos en este archivo....
r556 if code_selected[j] == 1:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 tempx[i] = tempx[i] + \
2**(len(code_selected) - 1 - j)
Alexander Valdez
Encontre un bug durante la escritura de datos en este archivo....
r556 start = start + 32
end = end + 32
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Alexander Valdez
Encontre un bug durante la escritura de datos en este archivo....
r556 tempx = tempx.astype('u4')
tempx.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 # if self.line5Function == RCfunction.FLIP:
# self.flip1.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 #
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 # if self.line6Function == RCfunction.FLIP:
# self.flip2.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 get_ippSeconds(self):
'''
'''
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 ippSeconds = 2.0 * 1000 * self.ipp / SPEED_OF_LIGHT
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 ippSeconds
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 set_ippSeconds(self, ippSeconds):
'''
'''
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
self.ipp = ippSeconds * SPEED_OF_LIGHT / (2.0 * 1000)
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 return
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 def get_size(self):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
self.__size = 116 + 12 * self.nWindows + 4 * self.numTaus
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if self.codeType != 0:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 self.__size += 4 + 4 + 4 * self.nCode * \
numpy.ceil(self.nBaud / 32.)
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 return self.__size
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 def set_size(self, value):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise IOError("size is a property and it cannot be set, just read")
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ippSeconds = property(get_ippSeconds, set_ippSeconds)
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 size = property(get_size, set_size)
Daniel Valdez
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 y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 ProcessingHeader(Header):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
# size = 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 dtype = None
blockSize = None
profilesPerBlock = None
dataBlocksPerFile = None
nWindows = None
processFlags = None
nCohInt = None
nIncohInt = None
totalSpectra = None
Jose Chavez
agregado metodos a header class
r980 structure = PROCESSING_STRUCTURE
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 flag_dc = None
flag_cspc = None
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
def __init__(self, dtype=0, blockSize=0, profilesPerBlock=0, dataBlocksPerFile=0, nWindows=0, processFlags=0, nCohInt=0,
nIncohInt=0, totalSpectra=0, nHeights=0, firstHeight=0, deltaHeight=0, samplesWin=0, spectraComb=0, nCode=0,
code=0, nBaud=None, shif_fft=False, flag_dc=False, flag_cspc=False, flag_decode=False, flag_deflip=False
):
# self.size = 0
Jose Chavez
agregado metodos a header class
r980 self.dtype = dtype
self.blockSize = 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 self.profilesPerBlock = 0
self.dataBlocksPerFile = 0
self.nWindows = 0
self.processFlags = 0
self.nCohInt = 0
self.nIncohInt = 0
self.totalSpectra = 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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.nHeights = 0
self.firstHeight = 0
self.deltaHeight = 0
self.samplesWin = 0
self.spectraComb = 0
Miguel Valdez
Bug fixed:...
r624 self.nCode = None
self.code = None
self.nBaud = None
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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.shif_fft = False
self.flag_dc = False
self.flag_cspc = False
Miguel Valdez
Bug fixed:...
r624 self.flag_decode = False
self.flag_deflip = False
José Chávez
test zmq for rawdata
r975 self.length = 0
Jose Chavez
agregado metodos a header class
r980
Daniel Valdez
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 read(self, fp):
José Chávez
test zmq for rawdata
r975 self.length = 0
try:
startFp = fp.tell()
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
José Chávez
test zmq for rawdata
r975 startFp = None
pass
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 try:
José Chávez
test zmq for rawdata
r975 if hasattr(fp, 'read'):
header = numpy.fromfile(fp, PROCESSING_STRUCTURE, 1)
else:
header = numpy.fromstring(fp, PROCESSING_STRUCTURE, 1)
self.length += header.nbytes
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("ProcessingHeader: " + str(e))
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 size = int(header['nSize'][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.dtype = int(header['nDataType'][0])
self.blockSize = int(header['nSizeOfDataBlock'][0])
self.profilesPerBlock = int(header['nProfilesperBlock'][0])
self.dataBlocksPerFile = int(header['nDataBlocksperFile'][0])
self.nWindows = int(header['nNumWindows'][0])
self.processFlags = header['nProcessFlags']
self.nCohInt = int(header['nCoherentIntegrations'][0])
self.nIncohInt = int(header['nIncoherentIntegrations'][0])
self.totalSpectra = int(header['nTotalSpectra'][0])
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 try:
if hasattr(fp, 'read'):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 samplingWindow = numpy.fromfile(
fp, SAMPLING_STRUCTURE, self.nWindows)
José Chávez
test zmq for rawdata
r975 else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 samplingWindow = numpy.fromstring(
fp[self.length:], SAMPLING_STRUCTURE, self.nWindows)
José Chávez
test zmq for rawdata
r975 self.length += samplingWindow.nbytes
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("ProcessingHeader: " + str(e))
José Chávez
test zmq for rawdata
r975 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.nHeights = int(numpy.sum(samplingWindow['nsa']))
self.firstHeight = float(samplingWindow['h0'][0])
self.deltaHeight = float(samplingWindow['dh'][0])
self.samplesWin = samplingWindow['nsa'][0]
José Chávez
test zmq for rawdata
r975
try:
if hasattr(fp, 'read'):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 self.spectraComb = numpy.fromfile(
fp, 'u1', 2 * self.totalSpectra)
José Chávez
test zmq for rawdata
r975 else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 self.spectraComb = numpy.fromstring(
fp[self.length:], 'u1', 2 * self.totalSpectra)
José Chávez
test zmq for rawdata
r975 self.length += self.spectraComb.nbytes
George Yong
Python 2to3, Spectra (all operations) working
r1167 except Exception as e:
print("ProcessingHeader: " + str(e))
José Chávez
test zmq for rawdata
r975 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 if ((self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE) == PROCFLAG.DEFINE_PROCESS_CODE):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 self.nCode = int(numpy.fromfile(fp, '<u4', 1))
self.nBaud = int(numpy.fromfile(fp, '<u4', 1))
self.code = numpy.fromfile(
fp, '<f4', self.nCode * self.nBaud).reshape(self.nCode, self.nBaud)
Miguel Valdez
Bug fixed:...
r624 if ((self.processFlags & PROCFLAG.EXP_NAME_ESP) == PROCFLAG.EXP_NAME_ESP):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 exp_name_len = int(numpy.fromfile(fp, '<u4', 1))
exp_name = numpy.fromfile(fp, 'u1', exp_name_len + 1)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if ((self.processFlags & PROCFLAG.SHIFT_FFT_DATA) == PROCFLAG.SHIFT_FFT_DATA):
self.shif_fft = True
else:
self.shif_fft = False
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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.processFlags & PROCFLAG.SAVE_CHANNELS_DC) == PROCFLAG.SAVE_CHANNELS_DC):
self.flag_dc = True
Miguel Valdez
Bug fixed:...
r624 else:
self.flag_dc = False
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 if ((self.processFlags & PROCFLAG.DECODE_DATA) == PROCFLAG.DECODE_DATA):
self.flag_decode = True
else:
self.flag_decode = False
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 if ((self.processFlags & PROCFLAG.DEFLIP_DATA) == PROCFLAG.DEFLIP_DATA):
self.flag_deflip = True
else:
self.flag_deflip = False
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 nChannels = 0
nPairs = 0
pairList = []
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
for i in range(0, self.totalSpectra * 2, 2):
if self.spectraComb[i] == self.spectraComb[i + 1]:
nChannels = nChannels + 1 # par de canales iguales
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 nPairs = nPairs + 1 # par de canales diferentes
pairList.append((self.spectraComb[i], self.spectraComb[i + 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.flag_cspc = False
if nPairs > 0:
self.flag_cspc = True
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 if startFp is not None:
endFp = size + startFp
if fp.tell() > endFp:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 sys.stderr.write(
"Warning: Processing header size is lower than it has to be")
José Chávez
test zmq for rawdata
r975 return 0
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
José Chávez
test zmq for rawdata
r975 if fp.tell() < endFp:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 sys.stderr.write(
"Warning: Processing header size is greater than it is considered")
Daniel Valdez
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
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 write(self, fp):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 # Clear DEFINE_PROCESS_CODE
Julio Valdez
-Writing files bug fixed
r704 self.processFlags = self.processFlags & (~PROCFLAG.DEFINE_PROCESS_CODE)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 headerTuple = (self.size,
self.dtype,
self.blockSize,
self.profilesPerBlock,
self.dataBlocksPerFile,
self.nWindows,
self.processFlags,
self.nCohInt,
self.nIncohInt,
self.totalSpectra)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
header = numpy.array(headerTuple, PROCESSING_STRUCTURE)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 header.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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.nWindows != 0:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 sampleWindowTuple = (
self.firstHeight, self.deltaHeight, self.samplesWin)
samplingWindow = numpy.array(sampleWindowTuple, SAMPLING_STRUCTURE)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 samplingWindow.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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.totalSpectra != 0:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 # spectraComb = numpy.array([],numpy.dtype('u1'))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 spectraComb = self.spectraComb
spectraComb.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed in ProcessingHeader: code is never stored
r778 # if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
# nCode = numpy.array([self.nCode], numpy.dtype('u4')) #Probar con un dato que almacene codigo, hasta el momento no se hizo la prueba
# nCode.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 #
Miguel Valdez
Bug fixed in ProcessingHeader: code is never stored
r778 # nBaud = numpy.array([self.nBaud], numpy.dtype('u4'))
# nBaud.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 #
Miguel Valdez
Bug fixed in ProcessingHeader: code is never stored
r778 # code = self.code.reshape(self.nCode*self.nBaud)
# code = code.astype(numpy.dtype('<f4'))
# code.tofile(fp)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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
Miguel Valdez
Bug fixed:...
r624 def get_size(self):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
self.__size = 40 + 12 * self.nWindows + 2 * self.totalSpectra
Miguel Valdez
Bug fixed in ProcessingHeader: code is never stored
r778 # if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
Miguel Valdez
Bug fixed:...
r624 # self.__size += 4 + 4 + 4*self.nCode*numpy.ceil(self.nBaud/32.)
Miguel Valdez
Bug fixed in ProcessingHeader: code is never stored
r778 # self.__size += 4 + 4 + 4 * self.nCode * self.nBaud
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 return self.__size
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 def set_size(self, value):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise IOError("size is a property and it cannot be set, just read")
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 return
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed:...
r624 size = property(get_size, set_size)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
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 RCfunction:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 NONE = 0
FLIP = 1
CODE = 2
SAMPLING = 3
LIN6DIV256 = 4
SYNCHRO = 5
Daniel Valdez
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 nCodeType:
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 NONE = 0
USERDEFINE = 1
BARKER2 = 2
BARKER3 = 3
BARKER4 = 4
BARKER5 = 5
BARKER7 = 6
BARKER11 = 7
BARKER13 = 8
AC128 = 9
COMPLEMENTARYCODE2 = 10
COMPLEMENTARYCODE4 = 11
COMPLEMENTARYCODE8 = 12
COMPLEMENTARYCODE16 = 13
COMPLEMENTARYCODE32 = 14
COMPLEMENTARYCODE64 = 15
COMPLEMENTARYCODE128 = 16
CODE_BINARY28 = 17
class PROCFLAG:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 COHERENT_INTEGRATION = numpy.uint32(0x00000001)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 DECODE_DATA = numpy.uint32(0x00000002)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 SPECTRA_CALC = numpy.uint32(0x00000004)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 INCOHERENT_INTEGRATION = numpy.uint32(0x00000008)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 POST_COHERENT_INTEGRATION = numpy.uint32(0x00000010)
SHIFT_FFT_DATA = numpy.uint32(0x00000020)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 DATATYPE_CHAR = numpy.uint32(0x00000040)
DATATYPE_SHORT = numpy.uint32(0x00000080)
DATATYPE_LONG = numpy.uint32(0x00000100)
DATATYPE_INT64 = numpy.uint32(0x00000200)
DATATYPE_FLOAT = numpy.uint32(0x00000400)
DATATYPE_DOUBLE = numpy.uint32(0x00000800)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
DATAARRANGE_CONTIGUOUS_CH = numpy.uint32(0x00001000)
DATAARRANGE_CONTIGUOUS_H = numpy.uint32(0x00002000)
DATAARRANGE_CONTIGUOUS_P = numpy.uint32(0x00004000)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 SAVE_CHANNELS_DC = numpy.uint32(0x00008000)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 DEFLIP_DATA = numpy.uint32(0x00010000)
DEFINE_PROCESS_CODE = numpy.uint32(0x00020000)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ACQ_SYS_NATALIA = numpy.uint32(0x00040000)
ACQ_SYS_ECHOTEK = numpy.uint32(0x00080000)
ACQ_SYS_ADRXD = numpy.uint32(0x000C0000)
ACQ_SYS_JULIA = numpy.uint32(0x00100000)
ACQ_SYS_XXXXXX = numpy.uint32(0x00140000)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 EXP_NAME_ESP = numpy.uint32(0x00200000)
CHANNEL_NAMES_ESP = numpy.uint32(0x00400000)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 OPERATION_MASK = numpy.uint32(0x0000003F)
DATATYPE_MASK = numpy.uint32(0x00000FC0)
DATAARRANGE_MASK = numpy.uint32(0x00007000)
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 ACQ_SYS_MASK = numpy.uint32(0x001C0000)
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
dtype0 = numpy.dtype([('real', '<i1'), ('imag', '<i1')])
dtype1 = numpy.dtype([('real', '<i2'), ('imag', '<i2')])
dtype2 = numpy.dtype([('real', '<i4'), ('imag', '<i4')])
dtype3 = numpy.dtype([('real', '<i8'), ('imag', '<i8')])
dtype4 = numpy.dtype([('real', '<f4'), ('imag', '<f4')])
dtype5 = numpy.dtype([('real', '<f8'), ('imag', '<f8')])
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616
NUMPY_DTYPE_LIST = [dtype0, dtype1, dtype2, dtype3, dtype4, dtype5]
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120 PROCFLAG_DTYPE_LIST = [PROCFLAG.DATATYPE_CHAR,
PROCFLAG.DATATYPE_SHORT,
PROCFLAG.DATATYPE_LONG,
PROCFLAG.DATATYPE_INT64,
PROCFLAG.DATATYPE_FLOAT,
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 PROCFLAG.DATATYPE_DOUBLE]
DTYPE_WIDTH = [1, 2, 4, 8, 4, 8]
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 def get_dtype_index(numpy_dtype):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 index = None
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 for i in range(len(NUMPY_DTYPE_LIST)):
if numpy_dtype == NUMPY_DTYPE_LIST[i]:
index = i
break
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 return index
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 def get_numpy_dtype(index):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 return NUMPY_DTYPE_LIST[index]
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 def get_procflag_dtype(index):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 return PROCFLAG_DTYPE_LIST[index]
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 def get_dtype_width(index):
José Chávez
formatting y raise cuando digitalrf recibe spectra
r1120
George Yong
Python 2to3, Spectra (all operations) working
r1167 return DTYPE_WIDTH[index]