Hi Hao,

This was due to a bug in the _switch_pf function.  I've issued a pull request to fix it here: https://bitbucket.org/yt_analysis/yt/pull-request/1132/fixing-an-issue-with-plots-created-via/diff

-Nathan


On Tue, Aug 5, 2014 at 6:57 AM, Hao Wang <hwang.phy@gmail.com> wrote:
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

_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org