In [14]:
%pylab inline
import glob
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
In [15]:
#JSAnimation is cloned as a submodule
sys.path.append('JSAnimation')
from JSAnimation import IPython_display
In [16]:
basename_regexp = "../../../waveheights_*.csv"
files = glob.glob(basename_regexp)
files.sort()
In [25]:
fig = plt.figure()
u1 = np.loadtxt(files[0], delimiter=',')
u1_min = np.amin(u1) * 0.9
u1_max = np.amax(u1) * 1.1
im = plt.imshow(u1, interpolation='nearest')
im.set_clim(u1_min, u1_max)
plt.colorbar()
def animate(file):
u1 = np.loadtxt(file, delimiter=',')
im.set_array(u1)
return [im]
im_ani = animation.FuncAnimation(fig, animate, files, interval=50, repeat_delay=200, blit=True)
im_ani
Out[25]:
In [11]: