<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Libby,<div><br></div><div>I think this was a bug in the callback.  It was looking in plot.data.hierarchy instead of plot.pf, where the unit conversions are stored.  I submitted a fix to the hg repo.  It should work now!</div><div><br></div><div>John</div><div><br><div><div>On 17 May 2010, at 11:10, Elizabeth Harper-Clark wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Dear all,<br><br>I am trying to add coordinate axes to a slice. Here is my code:<br><br>from yt.mods import *<br>import pylab<br>import sys<br>import cmath<br><br>frame_template = "aaWoC/%s/Density_slice_zoom_%01i_%04i"<br>
<br>for n in range(370,500): # make density slice with particles on<br>    pf = lagos.EnzoStaticOutput("WOCOUT/%s/DD%04i/data%04i" % (sys.argv[-1],n, n))<br>    pc = raven.PlotCollection(pf)<br>    for ax in range(3):<br>
        p = pc.add_slice("Density", ax, weight_field="Density")<br>        p.set_width(0.05,1)<br>        p.modify["coord_axes"](unit=None, coords=False)<br>        if na.any(pf.h.grid_particle_count):<br>
            p.modify["particles"](0.05, p_size=10.0, col='k')<br>            print "          XXXXX Particles present XXXXX"<br>        p.modify["text"]((0.101,0.899),"Time = %8.4f Myr" % (pf["InitialTime"]*pf["years"]/1.e6), text_args = {'color':'k'})<br>
        p.modify["text"]((0.1,0.9),"Time = %8.4f Myr" % (pf["InitialTime"]*pf["years"]/1.e6), text_args = {'color':'w'})<br>        pc.save(frame_template % (sys.argv[-1],ax,n), override=True)<br>
                <br clear="all">and here is the output I get:<br><br>[h-clark@tpb92-chroot my_scripts]$ python2.6 Density_slices_zoom.py experiments2<br>0.35 0.45 0.7<br>yt         INFO       2010-05-17 11:03:57,243 Getting the binary hierarchy<br>
yt         INFO       2010-05-17 11:03:57,291 Finished with binary hierarchy reading<br>yt         INFO       2010-05-17 11:03:57,295 Adding PotentialField to list of fields<br>yt         INFO       2010-05-17 11:03:57,295 Adding AccelerationField2 to list of fields<br>
yt         INFO       2010-05-17 11:03:57,295 Adding AccelerationField3 to list of fields<br>yt         INFO       2010-05-17 11:03:57,296 Adding AccelerationField1 to list of fields<br>yt.lagos   INFO       2010-05-17 11:03:57,518 Max Value is 7.53287e-17 at 0.6984863281250000 0.3586425781250000 0.3889160156250000 in grid EnzoGrid_0037 at level 4 (4, 4, 6)<br>
yt         INFO       2010-05-17 11:03:57,518 Created plot collection with default plot-center = [0.698486328125, 0.358642578125, 0.388916015625]<br>yt         INFO       2010-05-17 11:03:58,136 Added slice of Density at x = 0.698486328125 with 'center' = [0.698486328125, 0.358642578125, 0.388916015625]<br>
Traceback (most recent call last):<br>  File "Density_slices_zoom.py", line 34, in <module><br>    pc.save(frame_template % (sys.argv[-1],ax,n), override=True)<br>  File "/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/PlotCollection.py", line 83, in save<br>
    override=override, force_save=force_save))<br>  File "/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/PlotTypes.py", line 118, in save_image<br>    self._redraw_image()<br>  File "/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/PlotTypes.py", line 406, in _redraw_image<br>
    self._run_callbacks()<br>  File "/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/PlotTypes.py", line 261, in _run_callbacks<br>    cb(self)<br>  File "/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/Callbacks.py", line 737, in __call__<br>
    unit_conversion = plot.data.hierarchy[<a href="http://plot.im/">plot.im</a>["Unit"]]<br>TypeError: 'EnzoHierarchy' object is unsubscriptable<br><br>Does anyone see what I am doing wrong?<br><br>many thanks,<br>
<br>Libby<br><br>-- <br>Elizabeth Harper-Clark MA MSci<br>PhD Candidate, Astrophysics, UofT<br><br><a href="http://www.astro.utoronto.ca/~h-clark">www.astro.utoronto.ca/~h-clark</a><br><a href="mailto:h-clark@cita.utoronto.ca">h-clark@cita.utoronto.ca</a><br>
AIM: edphc1<br>MSN: <a href="mailto:edphc1@hotmail.com">edphc1@hotmail.com</a><br>Skype: eharperclark<br>Office phone: 416-978-5759<br>
_______________________________________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br></blockquote></div><br></div></body></html>