[yt-users] Adding Coordinate axes

Elizabeth Harper-Clark h-clark at astro.utoronto.ca
Mon May 17 08:10:19 PDT 2010


Dear all,

I am trying to add coordinate axes to a slice. Here is my code:

from yt.mods import *
import pylab
import sys
import cmath

frame_template = "aaWoC/%s/Density_slice_zoom_%01i_%04i"

for n in range(370,500): # make density slice with particles on
    pf = lagos.EnzoStaticOutput("WOCOUT/%s/DD%04i/data%04i" %
(sys.argv[-1],n, n))
    pc = raven.PlotCollection(pf)
    for ax in range(3):
        p = pc.add_slice("Density", ax, weight_field="Density")
        p.set_width(0.05,1)
        p.modify["coord_axes"](unit=None, coords=False)
        if na.any(pf.h.grid_particle_count):
            p.modify["particles"](0.05, p_size=10.0, col='k')
            print "          XXXXX Particles present XXXXX"
        p.modify["text"]((0.101,0.899),"Time = %8.4f Myr" %
(pf["InitialTime"]*pf["years"]/1.e6), text_args = {'color':'k'})
        p.modify["text"]((0.1,0.9),"Time = %8.4f Myr" %
(pf["InitialTime"]*pf["years"]/1.e6), text_args = {'color':'w'})
        pc.save(frame_template % (sys.argv[-1],ax,n), override=True)

and here is the output I get:

[h-clark at tpb92-chroot my_scripts]$ python2.6 Density_slices_zoom.py
experiments2
0.35 0.45 0.7
yt         INFO       2010-05-17 11:03:57,243 Getting the binary hierarchy
yt         INFO       2010-05-17 11:03:57,291 Finished with binary hierarchy
reading
yt         INFO       2010-05-17 11:03:57,295 Adding PotentialField to list
of fields
yt         INFO       2010-05-17 11:03:57,295 Adding AccelerationField2 to
list of fields
yt         INFO       2010-05-17 11:03:57,295 Adding AccelerationField3 to
list of fields
yt         INFO       2010-05-17 11:03:57,296 Adding AccelerationField1 to
list of fields
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)
yt         INFO       2010-05-17 11:03:57,518 Created plot collection with
default plot-center = [0.698486328125, 0.358642578125, 0.388916015625]
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]
Traceback (most recent call last):
  File "Density_slices_zoom.py", line 34, in <module>
    pc.save(frame_template % (sys.argv[-1],ax,n), override=True)
  File
"/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/PlotCollection.py",
line 83, in save
    override=override, force_save=force_save))
  File
"/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/PlotTypes.py",
line 118, in save_image
    self._redraw_image()
  File
"/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/PlotTypes.py",
line 406, in _redraw_image
    self._run_callbacks()
  File
"/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/PlotTypes.py",
line 261, in _run_callbacks
    cb(self)
  File
"/mnt/raid-project/murray/h-clark/YT/src/yt-trunk-svn/yt/raven/Callbacks.py",
line 737, in __call__
    unit_conversion = plot.data.hierarchy[plot.im["Unit"]]
TypeError: 'EnzoHierarchy' object is unsubscriptable

Does anyone see what I am doing wrong?

many thanks,

Libby

-- 
Elizabeth Harper-Clark MA MSci
PhD Candidate, Astrophysics, UofT

www.astro.utoronto.ca/~h-clark
h-clark at cita.utoronto.ca
AIM: edphc1
MSN: edphc1 at hotmail.com
Skype: eharperclark
Office phone: 416-978-5759
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20100517/0f65ad2e/attachment.htm>


More information about the yt-users mailing list