I am trying to upload a waveform to a signal generator. The first thing I need to do is read in the file. The file is a .wfm file. This is what it looks like when I open it in notepad.
I try to read in the file in different ways to try to see which one will work best for me.
fileName = 'C:/Users/cruzmeza/Desktop/16qam.wfm' lst = []
lst1 = []
DataIn = []
fi = open(fileName, 'rb')
data = fi.read()
fi.close()
wave = open(fileName, 'rb')
for x in wave:
lst.append(x)
wave.close()
f = open(fileName, "rb")
try:
byte = f.read(1)
while byte != "":
lst1.append(byte)
byte = f.read(1)
finally:
f.close()
print 'Done'
When I read the file I get the following for each method.
data
'\x0e\x87@q\x9f\x81R\xc7\x00\x8a\xf0\xa5\xdd\xd4
lst
['\x0e\x87@q\x9f\x81R\xc7\x00\x8a\xf0\
lst1
['\x0e', '\x87', '@', 'q', '\x9f
My question is, how do I change the hex values into their numerical value, int/float anything. There are about 2000 samples in the waveform file.
Instead of \x0e
I would like to have 14.0