-
Notifications
You must be signed in to change notification settings - Fork 1
/
plots.py
62 lines (55 loc) · 1.73 KB
/
plots.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
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('white')
import warnings
warnings.filterwarnings("ignore")
# import data
fname = "results_201.dat" #change this line to switch between q_i[3] = 2.00 and 2.01
results = np.loadtxt(open(fname), delimiter = ' ')
# label data
time = np.asarray([var[0] for var in results])
theta_1 = np.asarray([var[1] for var in results])
theta_1 = np.asarray([var[2] for var in results])
p_1 = np.asarray([var[3] for var in results])
p_2 = np.asarray([var[4] for var in results])
x_1 = np.asarray([var[5] for var in results])
y_1 = np.asarray([var[6] for var in results])
x_2 = np.asarray([var[7] for var in results])
y_2 = np.asarray([var[8] for var in results])
energy = np.asarray([var[9] for var in results])
# x_1 vs y_1
fig = plt.figure()
plt.title("x_1 vs y_1")
plt.xlabel("x_1")
plt.ylabel("y_1")
plt.plot(x_1, y_1, c = 'red')
plt.savefig("x1_vs_y1_201.pdf") #change this plot title between 2.00 and 2.01
plt.show()
# p_1 vs p_2
fig = plt.figure()
plt.title("p_1 vs p_2")
plt.xlabel("p_1")
plt.ylabel("p_2")
plt.plot(p_1, p_2, c = 'red')
plt.savefig("p1_vs_p2_201.pdf") #change this plot title between 2.00 and 2.01
plt.show()
# x_2 vs y_2
fig = plt.figure()
plt.title("x_2 vs y_2")
plt.xlabel("x_2")
plt.ylabel("y_2")
plt.plot(x_2, y_2, c = 'red')
plt.savefig("x2_vs_y2_201.pdf") #change this plot title between 2.00 and 2.01
plt.show()
# total energy vs time
fig = plt.figure()
plt.title("Total energy vs time")
plt.xlabel("Time")
plt.ylabel("Total Energy")
avg = np.average(energy) #to define range of graph
plt.ylim([avg - 0.1, avg + 0.1])
plt.plot(time, energy, c = 'red')
plt.savefig("ene_vs_t_201.pdf") #change this plot title between 2.00 and 2.01
plt.show(block = True)
###