[Numpy-discussion] Mirror/flip numpy array?

2009-07-17 Thread Johannes Bauer
Hello list,

I have a really simple newbie question: How can I mirror/flip a
numpy.ndarray? I.e. mirror switches the colums (leftmost becomes
rightmost and so on), flip changes the rows (top becomes bottom and so on)?

Kind regards,
Joe
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Mirror/flip numpy array?

2009-07-17 Thread Gary Ruben
In [1]: a=array([1,2,3])

In [2]: a[::-1]
Out[2]: array([3, 2, 1])


Johannes Bauer wrote:
 Hello list,
 
 I have a really simple newbie question: How can I mirror/flip a
 numpy.ndarray? I.e. mirror switches the colums (leftmost becomes
 rightmost and so on), flip changes the rows (top becomes bottom and so on)?
 
 Kind regards,
 Joe
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Mirror/flip numpy array?

2009-07-17 Thread Keith Goodman
On Fri, Jul 17, 2009 at 6:21 AM, Gary Rubengru...@bigpond.net.au wrote:
 In [1]: a=array([1,2,3])

 In [2]: a[::-1]
 Out[2]: array([3, 2, 1])


 Johannes Bauer wrote:
 Hello list,

 I have a really simple newbie question: How can I mirror/flip a
 numpy.ndarray? I.e. mirror switches the colums (leftmost becomes
 rightmost and so on), flip changes the rows (top becomes bottom and so on)?

There's also np.fliplr (left right) and np.flipud (up down). The last
line of these functions are return m[:, ::-1] and return
m[::-1,...], respectively.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion