[Yt-svn] commit/yt: sskory: Adding 'get_sphere()' to the LoadedHalos class.

Bitbucket commits-noreply at bitbucket.org
Mon Jul 25 07:53:42 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/d2f5fc1e596d/
changeset:   d2f5fc1e596d
branch:      yt
user:        sskory
date:        2011-07-25 16:53:06
summary:     Adding 'get_sphere()' to the LoadedHalos class.
affected #:  1 file (953 bytes)

--- a/yt/analysis_modules/halo_finding/halo_objects.py	Mon Jul 25 09:53:27 2011 -0400
+++ b/yt/analysis_modules/halo_finding/halo_objects.py	Mon Jul 25 08:53:06 2011 -0600
@@ -228,7 +228,8 @@
         r"""Returns a sphere source.
 
         This will generate a new, empty sphere source centered on this halo,
-        with the maximum radius of the halo.
+        with the maximum radius of the halo. This can be used like any other
+        data container in yt.
         
         Parameters
         ----------
@@ -974,6 +975,34 @@
         """
         return self.max_radius
 
+    def get_sphere(self):
+        r"""Returns a sphere source.
+
+        This will generate a new, empty sphere source centered on this halo,
+        with the maximum radius of the halo. This can be used like any other
+        data container in yt.
+        
+        Parameters
+        ----------
+        center_of_mass : bool, optional
+            True chooses the center of mass when calculating the maximum radius.
+            False chooses from the maximum density location for HOP halos
+            (it has no effect for FOF halos).
+            Default = True.
+        
+        Returns
+        -------
+        sphere : `yt.data_objects.api.AMRSphereBase`
+            The empty data source.
+
+        Examples
+        --------
+        >>> sp = halos[0].get_sphere()
+        """
+        cen = self.center_of_mass()
+        r = self.maximum_radius()
+        return self.pf.h.sphere(cen, r)
+
 class HaloList(object):
 
     _fields = ["particle_position_%s" % ax for ax in 'xyz']
@@ -2216,4 +2245,4 @@
         LoadedHaloList.__init__(self, pf, self.basename)
 
 
-        
\ No newline at end of file
+

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