[Yt-svn] yt-commit r554 - trunk/yt/lagos/hop
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Fri Jun 13 12:54:47 PDT 2008
Author: mturk
Date: Fri Jun 13 12:54:44 2008
New Revision: 554
URL: http://yt.spacepope.org/changeset/554
Log:
Added get_maximum_radius() and get_sphere() methods to the HopItem object.
Modified:
trunk/yt/lagos/hop/HopOutput.py
Modified: trunk/yt/lagos/hop/HopOutput.py
==============================================================================
--- trunk/yt/lagos/hop/HopOutput.py (original)
+++ trunk/yt/lagos/hop/HopOutput.py Fri Jun 13 12:54:44 2008
@@ -154,7 +154,22 @@
vy = (self["particle_velocity_x"] * pm).sum()
vz = (self["particle_velocity_x"] * pm).sum()
return na.array([vx,vy,vz])/pm.sum()
-
+
+ def maximum_radius(self):
+ center = self.center_of_mass()
+ r = na.sqrt((self["particle_position_x"]-center[0])**2.0
+ + (self["particle_position_y"]-center[1])**2.0
+ + (self["particle_position_z"]-center[2])**2.0)
+ return r.max()
def __getitem__(self, key):
return self.data[key][self.indices]
+
+ def get_sphere(self, center_of_mass=True):
+ if center_of_mass: center = self.center_of_mass()
+ else: center = self.maximum_density_location()
+ radius = self.maximum_radius()
+ # A bit of a long-reach here...
+ sphere = self.hop_output.data_source.hierarchy.sphere(
+ center, radius=radius)
+ return sphere
More information about the yt-svn
mailing list