-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhaseViewer_2d.py
More file actions
executable file
·84 lines (63 loc) · 2.17 KB
/
PhaseViewer_2d.py
File metadata and controls
executable file
·84 lines (63 loc) · 2.17 KB
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
#!/usr/bin/env python3
##############################################################
"""
___ _ _
/ _ \ |__ __ _ ___ ___/\ /(_) _____ _____ _ __
/ /_)/ '_ \ / _` / __|/ _ \ \ / / |/ _ \ \ /\ / / _ \ '__|
/ ___/| | | | (_| \__ \ __/\ V /| | __/\ V V / __/ |
\/ |_| |_|\__,_|___/\___| \_/ |_|\___| \_/\_/ \___|_|
A tool for visualizing cosmological phase transitions.
Author:
Web: https://github.com/phyzhangyang/PhaseViewer
"""
##############################################################
## External modules.
import imageio
import os,sys
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm, rc
sys.path.append(os.path.join(os.path.split(os.path.realpath(__file__))[0], "src"))
## Internal modules.
import initialize
from potential_2d import Veff
try:
latex = os.environ["MATPLOTLIB_LATEX"]
except KeyError:
latex = False
if latex:
rc('text', usetex=True)
rc('font', **{'family': 'serif'})
rc('font', **{'family': 'serif', 'size': 14})
scale = 1e-6
TC = 59.2297
h = np.linspace(-20, 100, 200)
s = np.linspace(-20, 100, 200)
hh, ss = np.meshgrid(h, s)
T = np.linspace(0, 100, 20)
#T = np.array([0, 10, 20, 30, 40, 50, 55, TC, 60, 65, 70, 80])
#xx, TT = np.meshgrid(x, T)
#VV = V(xx, TT)
#cp = ax.scatter(xx, scale * VV, c=TT, s=5, edgecolor='None', cmap=cm.get_cmap('rainbow', 15), alpha=0.8)
frames = []
for ii in range(len(T)):
fig, ax = plt.subplots()
Ti = T[ii]
Vi = Veff([hh,ss], Ti)
cp = ax.scatter(hh, ss, c=Vi, s=5, edgecolor='None', alpha=0.8)
# ax.text(43, -0.1, r'$T_C=59.2$ GeV')
plt.ticklabel_format(axis='y', style='sci', scilimits=(0, 3))
plt.grid(True, linestyle=':')
# ax.set_ylim(-1, 0.5)
# ax.set_xlim(-20, 90)
ax.set_ylabel(r'$V(\phi) \times 10^{-6}$ (GeV)${}^4$')
ax.set_xlabel(r'$\phi$ (GeV)')
# cb = fig.colorbar(cp)
# cb.set_label(r"$T$ (GeV)")
ax.set_title("T="+str(Ti))
# plt.show()
plt.savefig('temp.png', bbox_inches='tight')
frames.append(imageio.imread('temp.png'))
gif_name = 'new.gif'
duration =0.5
imageio.mimsave(gif_name, frames, 'GIF', duration=duration)