Skip to content

Commit

Permalink
fix [0,2pi] shift
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishavlin committed Oct 10, 2024
1 parent ad92f03 commit 9c76d68
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions yt/utilities/lib/pixelization_routines.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ def pixelize_cylinder(np.float64_t[:,:] buff,
cdef np.float64_t r_inc, theta_inc
cdef np.float64_t costheta, sintheta
cdef int i, i1, pi, pj
cdef np.float64_t twoPI = 2 * np.pi
cdef np.float64_t onePI = np.pi
cdef np.float64_t twoPI = 2 * onePI

cdef int imin, imax
imin = np.asarray(radius).argmin()
Expand Down Expand Up @@ -662,9 +663,9 @@ def pixelize_cylinder(np.float64_t[:,:] buff,
ptbounds[0] = fmin(ptbounds[0], corners[i1])
ptbounds[1] = fmax(ptbounds[1], corners[i1])

# shift to a [0, PI] interval
ptbounds[0] = ptbounds[0] % twoPI
ptbounds[1] = ptbounds[1] % twoPI
# shift to a [0, 2*PI] interval
ptbounds[0] = ptbounds[0] % twoPI + onePI
ptbounds[1] = ptbounds[1] % twoPI + onePI

if prbounds[0] >= rmin and prbounds[1] <= rmax and \
ptbounds[0] >= tmin and ptbounds[1] <= tmax:
Expand Down

0 comments on commit 9c76d68

Please sign in to comment.