-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools.py
66 lines (33 loc) · 1.03 KB
/
tools.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import numpy as np
import json
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.constants import G
import modello_fisico as md
from params import *
import execution
def plotta(file,energia):
f = open(file)
data = []
for line in f:
data.append(json.loads(line))
data = np.array(data)
#estrai colonne
theta = data[:,0]
omega = data[:,1]
theta2 = []
#x_int = np.linspace(1,len(energia),len(energia))
#theta = theta%(2*np.pi) #modulo per ottenere angoli fra 0 e 360
for angle in theta :
while angle>np.pi:
angle=angle-2*np.pi
while angle<-np.pi:
angle=angle+2*np.pi
theta2.append(angle)
plt.figure(1)
plt.plot(theta2, omega)
plt.grid(True)
plt.title('phase_space')
plt.xlabel('rad')
plt.ylabel('rad/s')
return