Wrap large and negative shifts
Wrap large and negative shifts

If a shift is larger than the frame size, convert to one that is within
the frame size. Also if a shift is negative, convert it to one that is
positive. This works as we have periodic boundary conditions as a
consequence of working in Fourier space. Thus each frame effectively has
another frame just like it on all of its boundaries and so on for each
of those frames. As a result, a shift equal to frame size in any
dimension is just a no-op for that dimension's shift. This allows us to
chose the smallest shifts possible.

jakirkham/nanshe,DudLab/nanshe,DudLab/nanshe,nanshe-org/nanshe,nanshe-org/nanshe,jakirkham/nanshe