[yt-svn] commit/yt: MatthewTurk: Merging the two yt-3.0 heads
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Oct 30 12:06:53 PDT 2013
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/40c2a3b55d6a/
Changeset: 40c2a3b55d6a
Branch: yt-3.0
User: MatthewTurk
Date: 2013-10-30 20:06:41
Summary: Merging the two yt-3.0 heads
Affected #: 1 file
diff -r 5df0d5742ff2e8abcb6dd032f82247af9c6f0409 -r 40c2a3b55d6ae9439124e4cbe1feecf3308c46f6 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
@@ -1124,106 +1124,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