[yt-svn] commit/yt: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Jun 3 12:45:18 PDT 2013


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/d3c41c6a6808/
Changeset:   d3c41c6a6808
Branch:      yt
User:        MatthewTurk
Date:        2013-05-31 21:25:54
Summary:     This resets the domain offset for halo centers-of-mass.

If c were shifted into the center of a domain that ran from -0.5 .. 0.5, this
would previously not have correctly worked.
Affected #:  1 file

diff -r 7576917f462cd323995eb47bfc16e65d2a4c5e5c -r d3c41c6a680871f9060ad36f9ff2cf9bebb7d9b8 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
@@ -165,7 +165,7 @@
             com.append(c[i])
         com = np.array(com)
         c = (com * pm).sum(axis=1) / pm.sum()
-        return c%self.pf.domain_width
+        return c%self.pf.domain_width + self.pf.domain_left_edge
 
     def maximum_density(self):
         r"""Return the HOP-identified maximum density. Not applicable to


https://bitbucket.org/yt_analysis/yt/commits/75a60215ce22/
Changeset:   75a60215ce22
Branch:      yt
User:        MatthewTurk
Date:        2013-05-31 21:41:17
Summary:     This offsets all the particles (duplicating the array in the process, which is
okay) and then checks which need to be shifted slightly differently.  Note that
also in the original formulation the particles got shifted in-place in some
cases, which could result in incorrect answers later on.  Maximum radius
behaves correctly.
Affected #:  1 file

diff -r d3c41c6a680871f9060ad36f9ff2cf9bebb7d9b8 -r 75a60215ce22fe8cca682a22f7004d57d01aac2d 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
@@ -143,10 +143,10 @@
             return self.CoM
         pm = self["ParticleMassMsun"]
         c = {}
-        c[0] = self["particle_position_x"]
-        c[1] = self["particle_position_y"]
-        c[2] = self["particle_position_z"]
-        c_vec = np.zeros(3)
+        # We shift into a box where the origin is the left edge
+        c[0] = self["particle_position_x"] - self.pf.domain_left_edge[0]
+        c[1] = self["particle_position_y"] - self.pf.domain_left_edge[1]
+        c[2] = self["particle_position_z"] - self.pf.domain_left_edge[2]
         com = []
         for i in range(3):
             # A halo is likely periodic around a boundary if the distance 
@@ -159,8 +159,7 @@
                 com.append(c[i])
                 continue
             # Now we want to flip around only those close to the left boundary.
-            d_left = c[i] - self.pf.domain_left_edge[i]
-            sel = (d_left <= (self.pf.domain_width[i]/2))
+            sel = (c[i] <= (self.pf.domain_width[i]/2))
             c[i][sel] += self.pf.domain_width[i]
             com.append(c[i])
         com = np.array(com)


https://bitbucket.org/yt_analysis/yt/commits/76857ec5fb59/
Changeset:   76857ec5fb59
Branch:      yt
User:        brittonsmith
Date:        2013-06-03 21:45:09
Summary:     Merged in MatthewTurk/yt (pull request #522)

This resets the domain offset for halo centers-of-mass.
Affected #:  1 file

diff -r 2ad91aa91e3054eadb445f88303d97842b68155f -r 76857ec5fb59898ac23c8831d9ddd0165809ad8b 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
@@ -143,10 +143,10 @@
             return self.CoM
         pm = self["ParticleMassMsun"]
         c = {}
-        c[0] = self["particle_position_x"]
-        c[1] = self["particle_position_y"]
-        c[2] = self["particle_position_z"]
-        c_vec = np.zeros(3)
+        # We shift into a box where the origin is the left edge
+        c[0] = self["particle_position_x"] - self.pf.domain_left_edge[0]
+        c[1] = self["particle_position_y"] - self.pf.domain_left_edge[1]
+        c[2] = self["particle_position_z"] - self.pf.domain_left_edge[2]
         com = []
         for i in range(3):
             # A halo is likely periodic around a boundary if the distance 
@@ -159,13 +159,12 @@
                 com.append(c[i])
                 continue
             # Now we want to flip around only those close to the left boundary.
-            d_left = c[i] - self.pf.domain_left_edge[i]
-            sel = (d_left <= (self.pf.domain_width[i]/2))
+            sel = (c[i] <= (self.pf.domain_width[i]/2))
             c[i][sel] += self.pf.domain_width[i]
             com.append(c[i])
         com = np.array(com)
         c = (com * pm).sum(axis=1) / pm.sum()
-        return c%self.pf.domain_width
+        return c%self.pf.domain_width + self.pf.domain_left_edge
 
     def maximum_density(self):
         r"""Return the HOP-identified maximum density. Not applicable to

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