Skip to content

Commit

Permalink
Move comment about periodic boundary close to statement
Browse files Browse the repository at this point in the history
  • Loading branch information
cphyc committed Nov 26, 2024
1 parent 0f2fe20 commit a070e42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions yt/visualization/volume_rendering/off_axis_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,19 +444,19 @@ def temp_weightfield(field, data):
# We need the width of the plot window in projected coordinates,
# i.e. we ignore the z-component
wmax = width[:2].max()
# Recenter positions w.r.t. center of the plot window
xyz = data_source.ds.arr(
np.zeros((len(data_source[vol.field]), 3)), "code_length"
)

# If we have periodic boundaries, we need to wrap the positions
for idim, periodic in enumerate(data_source.ds.periodicity):
axis = data_source.ds.coordinates.axis_order[idim]
# Recenter positions w.r.t. center of the plot window
xyz[..., idim] = data_source["index", axis] - center[idim]
if not periodic:
continue
# If we have periodic boundaries, we need to wrap the corresponding
# coordinates into [-w/2, +w/2]
w = data_source.ds.domain_width[idim]
# Wrap into [-w/2, +w/2]
xyz[..., idim] = (xyz[..., idim] + w / 2) % w - w / 2

# Rescale to [-0.5, +0.5]
Expand Down

0 comments on commit a070e42

Please sign in to comment.