import struct
import matplotlib.pyplot as plt
import numpy as np
BinFile = "dual_entry.bin"
SigOut = []
SigIn = []
k = 0
i = 0
with open(BinFile, "rb") as f:
byte = f.read(1)
while byte != "" and k < (3*12000):
byte = f.read(1)
if len(byte)>0:
i = (i+1)%4
if (k%1000000 == 0):
print k/1000000
k = k+1
if (i==0):
outSigLB = ord(byte)
elif (i==1):
outSigHB = ord(byte)
elif (i==2):
inSigLB = ord(byte)
elif (i==3):
inSigHB = ord(byte)
if ((k > (900*4)) and (k< (2000*4))):
SigOut.append((outSigHB*256+outSigLB)*(3.3/750))
SigIn.append((inSigHB*256+inSigLB - 107.0)*(50.0E-3/15.0))
0
f, axarr = plt.subplots(2, sharex=True)
axarr[0].plot(SigIn)
axarr[0].set_title('Signal In / Signal Out')
axarr[1].plot(SigOut)
plt.show()
SigOut = []
SigIn = []
k = 0
i = 0
with open(BinFile, "rb") as f:
byte = f.read(1)
while byte != "" and k < (3*12000):
byte = f.read(1)
if len(byte)>0:
i = (i+1)%4
if (k%1000000 == 0):
print k/1000000
k = k+1
if (i==0):
outSigLB = ord(byte)
elif (i==1):
outSigHB = ord(byte)
elif (i==2):
inSigLB = ord(byte)
elif (i==3):
inSigHB = ord(byte)
if ((k > (1700*4)) and (k< (2000*4))):
SigOut.append((outSigHB*256+outSigLB)*(3.3/750))
SigIn.append((inSigHB*256+inSigLB - 107.0)*(50.0E-3/15.0))
f, axarr = plt.subplots(2, sharex=True)
axarr[0].plot(SigIn)
axarr[0].set_title('Signal In / Signal Out')
axarr[1].plot(SigOut)
plt.show()
0