-
Notifications
You must be signed in to change notification settings - Fork 2
/
visualizer.py
39 lines (28 loc) · 2.75 KB
/
visualizer.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
import matplotlib.pyplot as plt
import numpy as np
s1 = [9380, 4600,640, 500,640, 500,640, 500,660, 500,640, 500,640, 500,640, 500,640, 500,640, 1640,660, 1640,640, 1640,640, 1660,640, 1640,660, 1620,660, 1640,640, 500,640, 500,640, 1660,640, 500,640, 1640,660, 1620,660, 500,640, 500,640, 500,640, 1640,660, 500,640, 1640,640, 500,660, 480,660, 1640,640, 1640,640, 1660,640, 43340,9400, 2240,640, 33984,9380, 2240,640, 33984,9380, 2240,640, 33984,9380, 2260,640, 33984,9380, 2240,640, 33984,9380, 2240,640, 33964,9380, 2240,640, 33984,9380, 2240,640, 33964,9400, 2240,640, 33964,9380, 2260,640, 33964,9380, 2240,660, 33964,9380, 2240,660, 33964,9380, 2240,640, 33964,9380, 2240,640, 33964,9400, 2240,640, 33944,9400, 2240,640, 33944,9400, 2240,640, 33944,9380, 2260,640, 33944,9380, 2240,660, 33944,9380, 2240,640, 33964,9380, 2240,660, 33944,9400, 2240,640, 33964,9400, 2220,660, 33964,9380, 2240,640, 33964,9380, 2240,660, 33944,9400, 2240,640, 33944,9400, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,660, 33944,9380, 2240,660, 33964,9380, 2240,640, 33964,9380, 2240,640, 33964,9400, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,660, 33944,9380, 2260,640, 33944,9400, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,660, 33964,9380, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,660, 33944,9380, 2260,640, 33964,9380, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,660, 33944,9400, 2240,640, 33964,9380, 2240,640, 33964,9400, 2240,640, 33964,9380, 2240,640, 33964,9380, 2260,640, 33964,9380, 2240,640, 33964,9400, 2220,660, 33964,9380, 2240,660, 33964,9380, 2240,640, 33964,9380, 2240,660, 33964,9380, 2240,660, 33944,9400, 2240,640, 33964,9380, 2240,660, 33964,9380, 2240,640, 33964,9380, 2240,660, 33944,9400, 2240,640, 33964,9380, 2240,640, 33964,9380, 2260,640, 33964,9380, 2240,640, 33964,9400, 2240,640, 33964,9380, 2240,640, 33964,9400, 2240,640, 33964,9400, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,660, 33964,9380, 2240,640, 33964,9400, 2240,640, 33964,9380, 2240,640, 33964,9400, 2240,640, 33964,9380, 2240,640, 33964,9380, 2240,660, 33964,9380, 2240,640, 33964,9380, 2240,660, 33964,9380, 2240,640, 33964,9380, 2240,660, 33964,9380, 2240,640]
def my_round(s, base=5):
rez = []
for x in s:
rez.append(base * round(x / base))
return rez
# s1 = my_round(s1, 600)
# print(s1)
# s1 = np.array(s1)//600
# print(list(s1))
def logic_to_signal(s):
a = []
rez = [0] * 10
for ind, t in enumerate(s):
if ind % 2 == 0:
io = 1
else:
io = 0
a.append(t)
rez = rez + [io] * t
print(a)
return rez + ([0] * 10)
plt.figure(figsize=(15, 5))
plt.plot(logic_to_signal(s1), linewidth=1)
plt.xlabel("TIme microseconds")
plt.show()