-
Notifications
You must be signed in to change notification settings - Fork 0
/
base-analysis.py
35 lines (29 loc) · 1 KB
/
base-analysis.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
from mypythontools import *
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.animation import FFMpegWriter
from tqdm import tqdm
metadata = dict(title='Movie Test', artist='Matplotlib',
comment='Movie support!')
fps = 30
subs = 5
writer = FFMpegWriter(fps=fps, metadata=metadata)
matplotlib.use("Agg")
fig = plt.figure()
means, Tlist, refs = cal_means('imagesup',lowT=2.0, highT=2.4, up=True)
# means, Tlist, refs = cal_means('imagesdown',up=False)
# plt.plot(Tlist, means,label='down')
plt.plot(Tlist, refs,label='Analytical Solution')
plt.plot(Tlist, means,label='Computation')
l, = plt.plot([Tlist[0]], [means[0]],'ro',label='Current T')
xlim = plt.xlim()
ylim = plt.ylim()
plt.legend()
plt.xlabel('T')
plt.ylabel(r'$\langle M \rangle$')
# plt.show()
with writer.saving(fig, "figureM.mp4", 300):
for i,(T,M) in tqdm(enumerate(zip(Tlist[::subs],means[::subs]))):
l.set_data(T,M)
writer.grab_frame()
make_video('./imagesup/',video_name='videouplong.mp4',subs=subs)