[yt-svn] commit/yt: ngoldbaum: Merged in hegan/yt/yt-3.0 (pull request #986)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Jul 2 00:27:38 PDT 2014
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/57ecc4cbdf24/
Changeset: 57ecc4cbdf24
Branch: yt-3.0
User: ngoldbaum
Date: 2014-07-02 09:27:28
Summary: Merged in hegan/yt/yt-3.0 (pull request #986)
Make annotate particles work with ptype
Affected #: 1 file
diff -r 5403193d8a46d5f8c166dbaa259653f6437056e6 -r 57ecc4cbdf24f36a5d522c983612468861ffde35 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -958,8 +958,7 @@
region = None
_descriptor = None
def __init__(self, width, p_size=1.0, col='k', marker='o', stride=1.0,
- ptype=None, stars_only=False, dm_only=False,
- minimum_mass=None, alpha=1.0):
+ ptype='all', minimum_mass=None, alpha=1.0):
PlotCallback.__init__(self)
self.width = width
self.p_size = p_size
@@ -967,8 +966,6 @@
self.marker = marker
self.stride = stride
self.ptype = ptype
- self.stars_only = stars_only
- self.dm_only = dm_only
self.minimum_mass = minimum_mass
self.alpha = alpha
@@ -988,24 +985,16 @@
axis_names = plot.data.pf.coordinates.axis_name
field_x = "particle_position_%s" % axis_names[xax]
field_y = "particle_position_%s" % axis_names[yax]
- gg = ( ( reg[field_x] >= x0 ) & ( reg[field_x] <= x1 )
- & ( reg[field_y] >= y0 ) & ( reg[field_y] <= y1 ) )
- if self.ptype is not None:
- gg &= (reg["particle_type"] == self.ptype)
- if gg.sum() == 0: return
- if self.stars_only:
- gg &= (reg["creation_time"] > 0.0)
- if gg.sum() == 0: return
- if self.dm_only:
- gg &= (reg["creation_time"] <= 0.0)
- if gg.sum() == 0: return
+ pt = self.ptype
+ gg = ( ( reg[pt, field_x] >= x0 ) & ( reg[pt, field_x] <= x1 )
+ & ( reg[pt, field_y] >= y0 ) & ( reg[pt, field_y] <= y1 ) )
if self.minimum_mass is not None:
- gg &= (reg["particle_mass"] >= self.minimum_mass)
+ gg &= (reg[pt, "particle_mass"] >= self.minimum_mass)
if gg.sum() == 0: return
plot._axes.hold(True)
px, py = self.convert_to_plot(plot,
- [np.array(reg[field_x][gg][::self.stride]),
- np.array(reg[field_y][gg][::self.stride])])
+ [np.array(reg[pt, field_x][gg][::self.stride]),
+ np.array(reg[pt, field_y][gg][::self.stride])])
plot._axes.scatter(px, py, edgecolors='None', marker=self.marker,
s=self.p_size, c=self.color,alpha=self.alpha)
plot._axes.set_xlim(xx0,xx1)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list