From: Angus M. <am...@gm...> - 2006-09-24 23:32:23
|
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. |