Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: perf improvements by skipping unnecessary symbolic unit computations #4071

Merged
merged 4 commits into from
Aug 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions yt/data_objects/index_subobjects/grid_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ def select_fcoords(self, dobj):
return np.empty((0, 3), dtype="float64")
coords = convert_mask_to_indices(mask, self._last_count).astype("float64")
coords += 0.5
coords *= self.dds[None, :]
coords += self.LeftEdge[None, :]
coords *= self.dds.d[None, :]
coords += self.LeftEdge.d[None, :]
return coords

def select_fwidth(self, dobj):
Expand All @@ -348,7 +348,7 @@ def select_fwidth(self, dobj):
return np.empty((0, 3), dtype="float64")
coords = np.empty((count, 3), dtype="float64")
for axis in range(3):
coords[:, axis] = self.dds[axis]
coords[:, axis] = self.dds.d[axis]
return coords

def select_ires(self, dobj):
Expand Down
7 changes: 4 additions & 3 deletions yt/geometry/geometry_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def fcoords(self):
c = obj.select_fcoords(self.dobj)
if c.shape[0] == 0:
continue
ci[ind : ind + c.shape[0], :] = c
ci.d[ind : ind + c.shape[0], :] = c
ind += c.shape[0]
return ci

Expand Down Expand Up @@ -363,7 +363,8 @@ def fwidth(self):
c = obj.select_fwidth(self.dobj)
if c.shape[0] == 0:
continue
ci[ind : ind + c.shape[0], :] = c
ci.d[ind : ind + c.shape[0], :] = c

ind += c.shape[0]
return ci

Expand Down Expand Up @@ -419,7 +420,7 @@ def fcoords_vertex(self):
c = obj.select_fcoords_vertex(self.dobj)
if c.shape[0] == 0:
continue
ci[ind : ind + c.shape[0], :, :] = c
ci.d[ind : ind + c.shape[0], :, :] = c
ind += c.shape[0]
return ci

Expand Down