[Yt-svn] yt-commit r1347 - in branches/yt-1.5/yt: raven reason
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Wed Jun 17 12:39:26 PDT 2009
Author: mturk
Date: Wed Jun 17 12:39:26 2009
New Revision: 1347
URL: http://yt.spacepope.org/changeset/1347
Log:
Back porting reason Notebook.py fix and the ptype arg for the callbacks
Modified:
branches/yt-1.5/yt/raven/Callbacks.py
branches/yt-1.5/yt/reason/Notebook.py
Modified: branches/yt-1.5/yt/raven/Callbacks.py
==============================================================================
--- branches/yt-1.5/yt/raven/Callbacks.py (original)
+++ branches/yt-1.5/yt/raven/Callbacks.py Wed Jun 17 12:39:26 2009
@@ -814,12 +814,19 @@
_type_name = "nparticles"
region = None
_descriptor = None
- def __init__(self, width, p_size=1.0, col='k', stride=1.0):
+ def __init__(self, width, p_size=1.0, col='k', stride=1.0, ptype=None):
+ """
+ Adds particle positions, based on a thick slab along *axis* with a
+ *width* along the line of sight. *p_size* controls the number of
+ pixels per particle, and *col* governs the color. *ptype* will
+ restrict plotted particles to only those that are of a given type.
+ """
PlotCallback.__init__(self)
self.width = width
self.p_size = p_size
self.color = col
self.stride = stride
+ self.ptype = ptype
def __call__(self, plot):
data = plot.data
@@ -835,6 +842,8 @@
gg = ( ( reg[field_x] >= x0 ) & ( reg[field_x] <= x1 )
& ( reg[field_y] >= y0 ) & ( reg[field_y] <= y1 ) )
print gg, reg[field_x][gg].size
+ if self.ptype is not None:
+ gg &= (reg["particle_type"] == self.ptype)
plot._axes.hold(True)
px, py = self.convert_to_pixels(plot,
[reg[field_x][gg][::self.stride],
Modified: branches/yt-1.5/yt/reason/Notebook.py
==============================================================================
--- branches/yt-1.5/yt/reason/Notebook.py (original)
+++ branches/yt-1.5/yt/reason/Notebook.py Wed Jun 17 12:39:26 2009
@@ -360,7 +360,7 @@
self.circles = []
if ytcfg.getboolean("reason","centeronmax"):
- self.center = outputfile.hierarchy.findMax("Density")[1]
+ self.center = outputfile.hierarchy.find_max("Density")[1]
PlotPage.__init__(self, parent, status_bar, mw, CreationID, parent_id)
self.SetBackgroundColour(wx.NamedColor("WHITE"))
@@ -457,7 +457,7 @@
self.UpdateWidth()
def OnCenterOnMax(self, event):
- v, c = self.outputfile.h.findMax("Density")
+ v, c = self.outputfile.h.find_max("Density")
Publisher().sendMessage(('viewchange','center'), c)
self.UpdateWidth()
More information about the yt-svn
mailing list