[yt-users] Animation of annotated projection plot

Hao Wang hwang.phy at gmail.com
Tue Aug 5 06:57:42 PDT 2014


Hi all,

I have been trying to make a movie out of annotated projection plots but
encountered the following problem:

------------error message-----------------------------
  File "...../yt/src/yt-hg/yt/visualization/plot_modifications.py", line
1157, in _get_region
    LE[zax] = data.center[zax] - self.width*0.5
TypeError: 'NoneType' object has no attribute '__getitem__'
--------------------------------------------------------------

I pasted the script (copied from the yt Cookbook) I used below. It worked
fine without the "prj.annotate_particles(1.0)" line. The annotation itself
works too -- the figure looks good in the IPython notebook.

======Script (anim.py)==================================
import matplotlib.animation as anim
from matplotlib.backends.backend_agg import FigureCanvasAgg
from yt.mods import *

prj = ProjectionPlot(load('DD0000/DD0000.hierarchy'), "z", 'Density')
prj.annotate_particles(1.0) # adding this line causes error

fig = prj.plots['Density'].figure
fig.canvas = FigureCanvasAgg(fig)

def animate(i):
    filename = './DD%04i/' % i + 'DD%04i' % i + '.hierarchy'
    pf = load(filename)
    prj._switch_pf(pf)

density_ani = anim.FuncAnimation(fig, animate, frames=100, interval=100,
        blit=False)

density_ani.save('density_animation.mp4')
====================

Could anyone point out the problem?

Thanks in advance,
Hao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140805/ca6589b7/attachment.htm>


More information about the yt-users mailing list