-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_subset.py
125 lines (89 loc) · 3.14 KB
/
plot_subset.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from run_evolution import folder_evol
g = 1
v, Q = 1, 1
tol, method = 1e-6, '12site'
D0, D = 256, 256
#
ms = [0, 0.1, 0.2, 0.318309886, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
mg = [g * x for x in ms]
NaDdt = [(512, 0.125, 1024, 1/16)] # (512, 0.0625, 256, 1/16),
data = {}
for m in ms:
for N, a, D, dt in NaDdt:
D0 = D
try:
folder = folder_evol(g, m, a, N, v, Q, D0, dt, D, tol, method, mkdir=False)
data[m, N, a, D, dt] = np.load(folder / f"results.npy", allow_pickle=True).item()
except FileNotFoundError:
pass
#
NUM_COLORS = 11
cm = plt.get_cmap('gist_rainbow')
colors = [cm(i / NUM_COLORS) for i in range(NUM_COLORS)]
lines = ['-', '--', ':']
#
def get_tsm(signals, ev):
tm = signals["time"]
mask = tm > -1
tm = tm[mask]
ee = signals[ev][mask]
ee = ee - ee[0, :]
ee = (ee[:, 0::2] + ee[:, 1::2]) / 2 # average over 2*n and 2*n+1
mid = (ee[:, N//4] +ee[:, N//4-1])/2
return tm, ee, mid
#
sel = [3, 4, 5, 6, 7]
plt.figure(figsize=(10, 5))
for j, (N, a, D, dt) in enumerate(NaDdt):
for i, m in enumerate(ms):
if i not in sel:
continue
tm, ee, mid = get_tsm(data[m, N, a, D, dt], 'Ln')
line, = plt.plot(tm[10:-2], mid[10:-2], lines[j], color=colors[i], label=f'{m/g=:.2f}')
if j == 2:
line.set_label(f'{m/g=:.2f}')
plt.legend()
plt.xlabel('t')
plt.title('Ln')
fig, ax = plt.subplots(1, 3, figsize=(13, 6))
for j, (N, a, D, dt) in enumerate(NaDdt):
for i, m in enumerate(ms):
if i not in sel:
continue
tm, ee, midE = get_tsm(data[m, N, a, D, dt], 'T00')
tm, ee, midp = get_tsm(data[m, N, a, D, dt], 'T11')
ax[0].plot(tm[10:-2], midE[10:-2], lines[j], color=colors[i], label=f'{m/g=:.2f}')
ax[1].plot(tm[10:-2], midp[10:-2], lines[j], color=colors[i], label=f'{m/g=:.2f}')
ax[2].plot(midp[10:-2], midE[10:-2], lines[j], color=colors[i], label=f'{m/g=:.2f}')
ax[0].set_title('T00')
ax[1].set_title('T11')
ax[2].set_title('T00 versus T11')
ax[0].set_xlabel('t')
ax[1].set_xlabel('t')
ax[2].set_xlabel('T11')
plt.legend()
plt.tight_layout()
fig, ax = plt.subplots(1, 2, figsize=(13, 6))
for j, (N, a, D, dt) in enumerate(NaDdt):
for i, m in enumerate(ms):
if i not in sel:
continue
ee = data[m, N, a, D, dt]["entropy_1"]
eemid = ee[:, N // 2] - ee[0, N // 2]
eerel = eemid/eemid[-1]
tm, ee, midE = get_tsm(data[m, N, a, D, dt], 'T00')
tm, ee, midp = get_tsm(data[m, N, a, D, dt], 'T11')
ax[0].plot(eerel[10:-2], midE[10:-2], lines[j], color=colors[i], label=f'{m/g=:.2f}')
ax[1].plot(eerel[10:-2], midp[10:-2], lines[j], color=colors[i], label=f'{m/g=:.2f}')
# ax[0].plot(tm[10:-2], midE[10:-2], lines[j], color=colors[i], label=f'{m/g=:.2f}')
# ax[1].plot(tm[10:-2], midp[10:-2], lines[j], color=colors[i], label=f'{m/g=:.2f}')
ax[0].set_title('T00')
ax[1].set_title('T11')
ax[0].set_xlabel(r'$S/S_{plateau}$')
ax[1].set_xlabel(r'$S/S_{plateau}$')
plt.legend()
plt.tight_layout()
plt.show()