[Numpy-discussion] Shift or rotate command?

Angus McMorland amcmorl at gmail.com
Sun Sep 24 18:32:21 CDT 2006


Hi all,

Other data languages that I have worked with have a routine for shifting
data along axes, with wrapping.
In IDL it's called 'shift', and works such that
print, a
0 1 2 3
4 5 6 7
8 9 10 11

print, shift(a, 2, 0)
2 3 0 1
6 7 4 5
10 11 8 9

print, shift(a, 2, 1)
10 11 8 9
2 3 0 1
6 7 4 5

In pdl (pdl.perl.org) the equivalent routine is called rotate. Is there a
version of this in numpy, or can it be easily achieved using existing
technology - I could do it with multiple sliced assignment statements but
that seems very clunky and likely slow. I've looked through the examples and
the numpy book but without success.

Angus.
-- 
AJC McMorland, PhD Student
Physiology, University of Auckland
Armourer, Auckland University Fencing
Secretary, Fencing North Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060925/da22f3ef/attachment.html 


More information about the Numpy-discussion mailing list