-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
50 lines (34 loc) · 915 Bytes
/
Copy pathplot.py
File metadata and controls
50 lines (34 loc) · 915 Bytes
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
import matplotlib.pyplot as plt
def der(x):
d = []
for i in range(3, len(x) - 1):
d.append(x[i] - x[i - 1])
return d
with open("pos.test") as file:
lines = file.readlines()
x = []
y = []
for lin in lines:
# if lin.startswith("x:"):
#
# val = float(lin.split()[1])
# x.append(val)
spl = lin.split()
if len(spl) > 2 and spl[-2] == "x:":
x.append(float(spl[-1]))
t = spl[2]
t = t.replace("[", "")
t = t.replace("]", "")
y.append(float(t))
# plt.plot(y[140:190], x[140:190]) #
# plt.plot(der(x))
with open("t2.test") as file:
lines = file.readlines()
x = []
for lin in lines:
if lin.startswith("x:"):
val = float(lin.split()[1])
x.append(val)
# plt.plot(x[30:80])
plt.plot(der(x))
plt.show()