In [ ]:
%matplotlib

In [1]:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import animation

import astropy.units as u

import sunpy.map
import glob

In [2]:
files = glob.glob('./gband_data/*.fits')
files.sort()
#files = files[::10]

In [4]:
x_range, y_range = [-400, 400]*u.arcsec, [-250, 250]*u.arcsec

In [5]:
fig = plt.figure(figsize=(16,10))
im = sunpy.map.Map(files[0]).submap(x_range, y_range).plot()
ax = plt.gca()

In [6]:
def update(i):
    print i
    m = sunpy.map.Map(files[i])
    im.set_data(m.data)
    im.set_norm(m.plot_settings['norm'])
    t = ax.set_title(m.name)

In [7]:
ani = animation.FuncAnimation(fig, update, frames=len(files))#, fargs=(ax, im, files))

In [9]:
fig.show()


/opt/miniconda/envs/sunpy-dev/lib/python2.7/site-packages/matplotlib/figure.py:397: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
  "matplotlib is currently using a non-GUI backend, "

In [10]:
Writer = animation.writers['ffmpeg']
writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)

In [12]:
ani.save('test.mp4', writer=writer)


0
0
0
0
0
0
0
0

In [ ]: