##// END OF EJS Templates
2.0.1.0...
2.0.1.0 JIRA 283 corrected (acquisition_time)

File last commit:

r126:5ae10b1b8078 VHDLib206
r164:3367da3ef050 patch rev 2
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