##// END OF EJS Templates
printf removed or replaced by PRINTF macros...
printf removed or replaced by PRINTF macros sequence counts modified for DUMP packets, now it depends on the source id bug 516 corrected

File last commit:

r126:5ae10b1b8078 VHDLib206
r227:919e10e56ea1 R3
Show More
readmatrix.py
34 lines | 1.1 KiB | text/x-python | PythonLexer
with open('asm_f0_test_paul_1.txt', 'r') as f:
listOfLines = []
for line in f.readlines():
listOfLines.append(line)
data = listOfLines[10] # line 9 contains the data
data = data.split() # get the data from the global string
dataInFloat = []
nbData = len(data)
print "nbData = " + str(nbData)
for i in range( nbData ):
dataInFloat.append( float( data[i] ) ) # convert each string into a float
# reorganize the data to have a matrix in the VHDL format
# input format (ICD format)
# matrix_0[0 .. 24] matrix_1[0 .. 24] .. matrix_127[0 .. 127]
# output format (VHDL format)
# component_0[0 .. 127] component_1[0 .. 127] .. component_24[0 .. 127]
dataInFloatReorganized = []
dataInIntReorganized = []
nbComponentsByMatrix = 25
nbFrequencyBins = 128
for indexComponent in range(nbComponentsByMatrix):
for frequencyBin in range(nbFrequencyBins):
dataInFloatReorganized.append(
dataInFloat[ indexComponent + frequencyBin * nbComponentsByMatrix ]
)
dataInIntReorganized.append(
int( dataInFloat[ indexComponent + frequencyBin * nbComponentsByMatrix ] )
)
print dataInIntReorganized