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

Don't allow edges to extend beyond domain for SPH region sources. #2644

Merged
merged 3 commits into from
Jun 19, 2020
Merged
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
21 changes: 17 additions & 4 deletions yt/geometry/coordinates/cartesian_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,23 @@ def _ortho_pixelize(self, data_source, field, bounds, size, antialias,
if isinstance(data_source, YTParticleProj):
weight = data_source.weight_field
le, re = data_source.data_source.get_bbox()
le[self.x_axis[dim]] = bounds[0]
le[self.y_axis[dim]] = bounds[2]
re[self.x_axis[dim]] = bounds[1]
re[self.y_axis[dim]] = bounds[3]
xa = self.x_axis[dim]
ya = self.y_axis[dim]
# If we're not periodic, we need to clip to the boundary edges
# or we get errors about extending off the edge of the region.
if not self.ds.periodicity[xa]:
le[xa] = max(bounds[0], self.ds.domain_left_edge[xa])
re[xa] = min(bounds[1], self.ds.domain_right_edge[xa])
else:
le[xa] = bounds[0]
re[xa] = bounds[1]
if not self.ds.periodicity[ya]:
le[ya] = max(bounds[2], self.ds.domain_left_edge[ya])
re[ya] = min(bounds[3], self.ds.domain_right_edge[ya])
else:
le[ya] = bounds[2]
re[ya] = bounds[3]
# We actually need to clip these
matthewturk marked this conversation as resolved.
Show resolved Hide resolved
proj_reg = data_source.ds.region(
left_edge=le, right_edge=re, center=data_source.center,
data_source=data_source.data_source
Expand Down