1. The yt Project
  2. Untitled project
  3. yt-3.0

Commits

Andrew Myers  committed d9d1d01

the IsBound derived quantity assumed that the domain_width was 1 in several places

  • Participants
  • Parent commits 958de8e
  • Branches yt

Comments (0)

Files changed (1)

File yt/data_objects/derived_quantities.py

View file
     # 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"]):
         # 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']),
         # 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.
         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]