[Numpy-discussion] shape is (3,4) or (3L,4L) ?

2013-09-13 Thread Mark Bakker
Hello List, I am teaching a Python programming class where students use their own computer. When I create an array with 3 rows and 4 columns, a = zeros((3,4)), and ask for the shape, shape(a), then some students get (3,4), while others get (3L,4L). I guess the 3L and 4L are long integers. I

[Numpy-discussion] can argmax be used to return row and column indices?

2013-09-13 Thread Mark Bakker
Hello list, I am trying to find the indices of the maximum value in a 2D array. argmax works fine, but returns the index in the flattened array. That is often not very convenient. Is there a function that returns the index of the row and column? Or can the index of the flattened array easily be

Re: [Numpy-discussion] can argmax be used to return row and column indices?

2013-09-13 Thread Gregorio Bastardo
Hi Mark, You're looking for np.unravel_index function. Cheers, Gregorio 2013/9/13 Mark Bakker mark...@gmail.com: Hello list, I am trying to find the indices of the maximum value in a 2D array. argmax works fine, but returns the index in the flattened array. That is often not very

Re: [Numpy-discussion] shape is (3,4) or (3L,4L) ?

2013-09-13 Thread David Cournapeau
Are they all using the same platform ? I suspect you're seeing the (3L, 4L) on windows 64 bits, correct ? FWIW, the numpy provided in Canopy is straight up upstream numpy + few patches not merged in releases yet, and any divergence from upstream would be considered as a bug by the canopy

Re: [Numpy-discussion] can argmax be used to return row and column indices?

2013-09-13 Thread Mark Bakker
Thanks, Gregorio. I would like it if argmax had a keyword option to return the row,column index automatically (or whatever the dimension of the array). Afterall, argmax already knows the shape of the array. Calling np.unravel_index( np.argmax( A ) ) seems unnecessarily long. But it works well

Re: [Numpy-discussion] shape is (3,4) or (3L,4L) ?

2013-09-13 Thread Mark Bakker
Now that you mention it, (3L,4L) probably indeed occurs on Windows 64 bit installations. Not sure about Mac 64 bit. I haven't tried that. So, is it desirable that the 32bit returns different integers than the 64bit? I would guess not. Thanks, Mark Are they all using the same platform ? I

Re: [Numpy-discussion] shape is (3,4) or (3L,4L) ?

2013-09-13 Thread Pierre Haessig
Hi, Le 13/09/2013 10:32, Mark Bakker a écrit : Now that you mention it, (3L,4L) probably indeed occurs on Windows 64 bit installations. Not sure about Mac 64 bit. I haven't tried that. So, is it desirable that the 32bit returns different integers than the 64bit? I would guess not. What I

Re: [Numpy-discussion] shape is (3,4) or (3L,4L) ?

2013-09-13 Thread Robert Kern
On Fri, Sep 13, 2013 at 9:51 AM, Pierre Haessig pierre.haes...@crans.org wrote: Hi, Le 13/09/2013 10:32, Mark Bakker a écrit : Now that you mention it, (3L,4L) probably indeed occurs on Windows 64 bit installations. Not sure about Mac 64 bit. I haven't tried that. So, is it desirable

Re: [Numpy-discussion] shape is (3,4) or (3L,4L) ?

2013-09-13 Thread Pierre Haessig
Hi Robert, Le 13/09/2013 11:22, Robert Kern a écrit : The Python `int` type represents a C `long` integer. On almost all 32-bit platforms, a C `long` is 32-bits, and memory addresses and offsets are also 32-bits. On 64-bit platforms, memory addresses and offsets are 64-bits, but nothing in

Re: [Numpy-discussion] can argmax be used to return row and column indices?

2013-09-13 Thread Gregorio Bastardo
There's already been some dance around this topic, maybe you will find the concept behind it: http://search.gmane.org/?query=unravel_indexgroup=gmane.comp.python.numeric.general 2013/9/13 Mark Bakker mark...@gmail.com: Thanks, Gregorio. I would like it if argmax had a keyword option to

[Numpy-discussion] [ANN] Introductory Pytroll Workshop, Nov. 25-26 2013, at SMHI, Sweden

2013-09-13 Thread Martin Raspaud
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [sorry for crossposting] Hi all, After the success of last years workshop, we decided to hold the Pytroll workshop this year again at SMHI. Pytroll is a collection of free and open source python modules for the reading, interpretation, and writing

[Numpy-discussion] [ANN] Introductory Pytroll Workshop, Nov. 25-26 2013, at SMHI, Sweden

2013-09-13 Thread Martin Raspaud
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [sorry for crossposting] Hi all, After the success of last years workshop, we decided to hold the Pytroll workshop this year again at SMHI. Pytroll is a collection of free and open source python modules for the reading, interpretation, and writing

Re: [Numpy-discussion] can argmax be used to return row and column indices?

2013-09-13 Thread Benjamin Root
On Fri, Sep 13, 2013 at 4:27 AM, Mark Bakker mark...@gmail.com wrote: Thanks, Gregorio. I would like it if argmax had a keyword option to return the row,column index automatically (or whatever the dimension of the array). Afterall, argmax already knows the shape of the array. Calling

Re: [Numpy-discussion] ANN: 1.8.0b2 release.

2013-09-13 Thread Charles R Harris
Hi Christolph, Could you debug this a bit? ERROR: test_record_no_hash (test_multiarray.TestRecord) -- Traceback (most recent call last): File X:\Python33\lib\site- packages\numpy\core\tests\test_multiarray.py, line 2464, in