[yt-svn] commit/yt: brittonsmith: Removing some nearest_neighbor functions from halo finding that depend on non-existent functions that won't be replaced. This closes Issue #626.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Oct 4 10:12:36 PDT 2013


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/c1540c8d27cb/
Changeset:   c1540c8d27cb
Branch:      yt-3.0
User:        brittonsmith
Date:        2013-10-04 18:28:18
Summary:     Removing some nearest_neighbor functions from halo finding that depend on non-existent functions that won't be replaced.  This closes Issue #626.
Affected #:  1 file

diff -r 2c8e6279eb37d4966d28f951e3831e1aefea2baa -r c1540c8d27cb3d69136f35d0435cf64871f5aaee yt/analysis_modules/halo_finding/halo_objects.py
--- a/yt/analysis_modules/halo_finding/halo_objects.py
+++ b/yt/analysis_modules/halo_finding/halo_objects.py
@@ -1137,106 +1137,6 @@
     def __getitem__(self, key):
         return self._groups[key]
 
-    def nearest_neighbors_3D(self, haloID, num_neighbors=7, search_radius=.2):
-        r"""For a halo its nearest neighbors in 3D using the kd tree.
-
-        This will calculate the nearest neighbors of a halo, using the kD tree.
-        Returns a list of the neighbors distances and ID with format
-        [distance,haloID].
-
-        Parameters
-        ----------
-        haloID : integer
-            The halo to find neighbors for.
-        num_neighbors : integer
-            How many neighbors to search for. Default = 7.
-        search_radius : float
-            How far away to look for neighbors in code units. Default = 0.2.
-
-        Examples
-        --------
-        >>> neighbors = halos.nearest_neighbors_3D(0)
-        """
-        period = self.pf.domain_right_edge - self.pf.domain_left_edge
-        # Initialize the dataset of points from all the haloes
-        dataset = []
-        for group in self:
-            p = Point()
-            p.data = group.center_of_mass().tolist()
-            p.haloID = group.id
-            dataset.append(p)
-        mylog.info('Building kd tree...')
-        kd = buildKdHyperRectTree(dataset[:], 2 * num_neighbors)
-        # make the neighbors object
-        neighbors = Neighbors()
-        neighbors.k = num_neighbors
-        neighbors.points = []
-        neighbors.minDistanceSquared = search_radius * search_radius
-        mylog.info('Finding nearest neighbors...')
-        getKNN(self[haloID].center_of_mass().tolist(), kd, neighbors, 0.,
-            period.tolist())
-        # convert the data in order to return something less perverse than a
-        # Neighbors object, also root the distances
-        n_points = []
-        for n in neighbors.points:
-            n_points.append([math.sqrt(n[0]), n[1].haloID])
-        return n_points
-
-    def nearest_neighbors_2D(self, haloID, num_neighbors=7, search_radius=.2,
-        proj_dim=0):
-        r"""For a halo its nearest neighbors in 2D using the kd tree.
-
-        This will strip a dimension from consideration in the kD-tree, and then
-        calculate all the nearest projected neighbors of a halo.  Returns a
-        list of the neighbors distances and ID with format [distance,haloID].
-
-        Parameters
-        ----------
-        haloID : int
-            The halo to find neighbors for.
-        num_neighbors : int
-            How many neighbors to search for. Default = 7.
-        search_radius : float
-            How far away to look for neighbors in code units. Default = 0.2.
-        proj_dim : int
-            Which dimension (0, 1, or 2) to project the halos into 2D.
-            Default = 0.
-
-        Examples
-        --------
-        >>> neighbors = halos.nearest_neighbors_2D(0)
-        """
-        # Set up a vector to multiply other
-        # vectors by to project along proj_dim
-        vec = np.array([1., 1., 1.])
-        vec[proj_dim] = 0.
-        period = self.pf.domain_right_edge - self.pf.domain_left_edge
-        period = period * vec
-        # Initialize the dataset of points from all the haloes
-        dataset = []
-        for group in self:
-            p = Point()
-            cm = group.center_of_mass() * vec
-            p.data = cm.tolist()
-            p.haloID = group.id
-            dataset.append(p)
-        mylog.info('Building kd tree...')
-        kd = buildKdHyperRectTree(dataset[:], 2 * num_neighbors)
-        # make the neighbors object
-        neighbors = Neighbors()
-        neighbors.k = num_neighbors
-        neighbors.points = []
-        neighbors.minDistanceSquared = search_radius * search_radius
-        mylog.info('Finding nearest neighbors...')
-        cm = self[haloID].center_of_mass() * vec
-        getKNN(cm.tolist(), kd, neighbors, 0., period.tolist())
-        # convert the data in order to return something less perverse than a
-        # Neighbors object, also root the distances
-        n_points = []
-        for n in neighbors.points:
-            n_points.append([math.sqrt(n[0]), n[1].haloID])
-        return n_points
-
     def write_out(self, filename, ellipsoid_data=False):
         r"""Write out standard halo information to a text 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