-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
test_dual_entry.py
50 lines (41 loc) · 927 Bytes
/
test_dual_entry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------
# (c) kelu124
# cc-by-sa/4.0/
# -------------------------
'''Description: showing content of a PRUDAQ binary dump over 3 periods.'''
__author__ = "kelu124"
__copyright__ = "Copyright 2016, Kelu124"
__license__ = "cc-by-sa/4.0/"
import struct
import matplotlib.pyplot as plt
import numpy as np
BinFile = "dual_entry.bin"
bytes_read = open(BinFile, "rb").read()
i = 0
k = 0
data = []
autredata = []
lb = 0
hb = 0
with open(BinFile, "rb") as f:
byte = f.read(1)
while byte != "" and k < (3*12000):
# Do stuff with byte.
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):
lb = ord(byte)
elif (i==1):
hb = ord(byte)
data.append(hb*256+lb)
#print i
print data
print len(data)
plt.plot(data) # on utilise la fonction sinus de Numpy
plt.show()