[yt-svn] commit/yt: Andrew Myers: the IsBound derived quantity assumed that the domain_width was 1 in several places

Bitbucket commits-noreply at bitbucket.org
Sun Jan 20 06:19:19 PST 2013


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/d9d1d01becc7/
changeset:   d9d1d01becc7
branch:      yt
user:        Andrew Myers
date:        2013-01-19 20:50:00
summary:     the IsBound derived quantity assumed that the domain_width was 1 in several places
affected #:  1 file

diff -r 958de8ec7d1489664bd88f57054352cee0c82559 -r d9d1d01becc7f05c96e91da73652fa13004eee4c yt/data_objects/derived_quantities.py
--- a/yt/data_objects/derived_quantities.py
+++ b/yt/data_objects/derived_quantities.py
@@ -389,7 +389,7 @@
     # in code.
     G = 6.67e-8 / data.convert("cm") # cm^3 g^-1 s^-2
     # Check for periodicity of the clump.
-    two_root = 2. / np.array(data.pf.domain_dimensions)
+    two_root = 2. * np.array(data.pf.domain_width) / np.array(data.pf.domain_dimensions)
     domain_period = data.pf.domain_right_edge - data.pf.domain_left_edge
     periodic = np.array([0., 0., 0.])
     for i,dim in enumerate(["x", "y", "z"]):
@@ -432,7 +432,7 @@
         # Calculate the binding energy using the treecode method.
         # Faster but less accurate.
         # The octree doesn't like uneven root grids, so we will make it cubical.
-        root_dx = 1./np.array(data.pf.domain_dimensions).astype('float64')
+        root_dx = (data.pf.domain_width/np.array(data.pf.domain_dimensions)).astype('float64')
         left = min([np.amin(local_data['x']), np.amin(local_data['y']),
             np.amin(local_data['z'])])
         right = max([np.amax(local_data['x']), np.amax(local_data['y']),
@@ -443,8 +443,8 @@
         # edges for making indexes.
         cover_min = cover_min - cover_min % root_dx
         cover_max = cover_max - cover_max % root_dx
-        cover_imin = (cover_min * np.array(data.pf.domain_dimensions)).astype('int64')
-        cover_imax = (cover_max * np.array(data.pf.domain_dimensions) + 1).astype('int64')
+        cover_imin = (cover_min / root_dx).astype('int64')
+        cover_imax = (cover_max / root_dx + 1).astype('int64')
         cover_ActiveDimensions = cover_imax - cover_imin
         # Create the octree with these dimensions.
         # One value (mass) with incremental=True.
@@ -456,7 +456,7 @@
         dyes = np.unique(data['dy']) # so these will all have the same
         dzes = np.unique(data['dz']) # order.
         # We only need one dim to figure out levels, we'll use x.
-        dx = 1./data.pf.domain_dimensions[0]
+        dx = data.pf.domain_width[0]/data.pf.domain_dimensions[0]
         levels = (np.log(dx / dxes) / np.log(data.pf.refine_by)).astype('int')
         lsort = levels.argsort()
         levels = levels[lsort]

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