[yt-users] Two new (undocumented) features: halo callback and periodic boundary conditions

Matthew Turk matthewturk at gmail.com
Fri Sep 12 14:29:53 PDT 2008


Hi guys,

There are two new things I've found it necessary to add lately.  These
are only in trunk/ , so if you're on branches/yt-1.0 , you won't have
them.  (They might not be stable yet anyway!)

The first is a hop circle callback.  It accepts the output from Hop
and adds on circles at the halo centers with the maximum particle
radius as the radius of the circle.  Here is a full example script,
where it looks for halos in the *entire* dataset, then projects
density and overplots the halo positions.  You can also feed in a
max_number argument to the HopCircleCallback, and it will only plot
the first N halos, in order of decreasing mass.

--
pf = EnzoStaticOutput("my_data0001.dir/my_data0001")
hop = hop.HopList(pf.h.sphere([0.5]*3, 1.00))
pc = PlotCollection(pf,center=[0.5]*3)

for ax in range(3):
    pc.add_projection("Density", ax)
    pc.plots[ax].add_callback(HopCircleCallback(hop, ax))
--

The other new addition is periodic plots.  For this one, you can now do:

--
pf = EnzoStaticOutput("my_data0001.dir/my_data0001")
pc = PlotCollection(pf,center=[0.5, 0.8, 0.8])
pc.add_projection("Density", 0, periodic=True)
--

note that the only difference is the keyword argument periodic=True.
This will wrap your plot around based on its current center and the
size of the domain.  (It should respect axially-dependent
DomainLeftEdge and DomainRightEdge.)

Additionally -- for those of you that have read all the way to the
bottom -- I started working on a profile to use inside IPython
(ipython.scipy.org), which is just the most amazing Python shell in
the world.  Jeff Oishi is more of an IPython expert than I am, so
he'll be adding to it and cleaning up my mistakes, but the end result
is going to be that the operations of moving around, opening data,
recursively finding data and examining data are all going to be
simplified significantly.  Much of the verbosity of the scripting
interface is going to be hidden from the user and the guts will be
more easily exposed.

Have a good one!

-Matt



More information about the yt-users mailing list