Re: [Numpy-discussion] Indexing bug

2013-04-05 Thread Aronne Merrelli
On Sun, Mar 31, 2013 at 12:14 AM, Ivan Oseledets ivan.oseled...@gmail.comwrote: snip Oh! So it is not a bug, it is a feature, which is completely incompatible with other array based languages (MATLAB and Fortran). To me, I can not find a single explanation why it is so in numpy. Taking

Re: [Numpy-discussion] Indexing bug

2013-04-02 Thread Nathaniel Smith
On Sun, Mar 31, 2013 at 6:14 AM, Ivan Oseledets ivan.oseled...@gmail.com wrote: I am using numpy 1.6.1, and encountered a wierd fancy indexing bug: import numpy as np c = np.random.randn(10,200,10); In [29]: print c[[0,1],:200,:2].shape (2, 200, 2) In [30]: print

Re: [Numpy-discussion] Indexing bug

2013-03-31 Thread David Cournapeau
On Sun, Mar 31, 2013 at 6:14 AM, Ivan Oseledets ivan.oseled...@gmail.com wrote: Message: 2 Date: Sat, 30 Mar 2013 11:13:35 -0700 From: Jaime Fern?ndez del R?o jaime.f...@gmail.com Subject: Re: [Numpy-discussion] Indexing bug? To: Discussion of Numerical Python numpy-discussion@scipy.org

[Numpy-discussion] Indexing bug?

2013-03-30 Thread Ivan Oseledets
I am using numpy 1.6.1, and encountered a wierd fancy indexing bug: import numpy as np c = np.random.randn(10,200,10); In [29]: print c[[0,1],:200,:2].shape (2, 200, 2) In [30]: print c[[0,1],:200,[0,1]].shape (2, 200) It means, that here fancy indexing is not working right for a 3d array. Is

Re: [Numpy-discussion] Indexing bug?

2013-03-30 Thread Jaime Fernández del Río
On Sat, Mar 30, 2013 at 11:01 AM, Ivan Oseledets ivan.oseled...@gmail.comwrote: I am using numpy 1.6.1, and encountered a wierd fancy indexing bug: import numpy as np c = np.random.randn(10,200,10); In [29]: print c[[0,1],:200,:2].shape (2, 200, 2) In [30]: print

[Numpy-discussion] Indexing bug in structured arrays(?)

2011-04-02 Thread Chris Fonnesbeck
I am either getting a nasty bug when indexing structured arrays, or I don't really understand how they work. I have imported some data using genfromtxt and an associated list of dtypes: ndtype=[('include', int), ('year', int), ('month', int), ('day', int), ('deg_day_north', int),

Re: [Numpy-discussion] Indexing bug in structured arrays(?)

2011-04-02 Thread Chris
Figured out why this does not work. Sorry and thanks. cf ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] indexing bug?

2007-10-03 Thread Charles R Harris
On 10/3/07, Perry Greenfield [EMAIL PROTECTED] wrote: On Sep 28, 2007, at 4:23 PM, Stefan van der Walt wrote: On Fri, Sep 28, 2007 at 03:07:30PM -0400, Nadia Dencheva wrote: This should return an error and not silently truncate to int. Why do you say that? The current behaviour is

Re: [Numpy-discussion] indexing bug?

2007-10-03 Thread Stefan van der Walt
On Wed, Oct 03, 2007 at 11:12:07AM -0400, Perry Greenfield wrote: On Sep 28, 2007, at 4:23 PM, Stefan van der Walt wrote: On Fri, Sep 28, 2007 at 03:07:30PM -0400, Nadia Dencheva wrote: This should return an error and not silently truncate to int. Why do you say that? The current behaviour

Re: [Numpy-discussion] indexing bug?

2007-10-03 Thread Perry Greenfield
On Oct 3, 2007, at 1:35 PM, Stefan van der Walt wrote: We certainly can't change it now (just imagine all the code out there that will break); but I personally don't think it is a big problem. I disagree. If people are willing to change the Class API of numpy to be consistent with

Re: [Numpy-discussion] indexing bug?

2007-10-03 Thread Christopher Barker
Stefan van der Walt wrote: The current behavior is consistent and well defined: a[x] == a[int(x)] This is all possible because of PEP 357: http://www.python.org/dev/peps/pep-0357/ However, when I read this from the PEP: It is not possible to use the nb_int (and __int__ special method) for

Re: [Numpy-discussion] indexing bug?

2007-10-03 Thread Timothy Hochberg
On 10/3/07, Christopher Barker [EMAIL PROTECTED] wrote: Stefan van der Walt wrote: The current behavior is consistent and well defined: a[x] == a[int(x)] This is all possible because of PEP 357: I think that the current behavior has always been possible; arbitrary objects can be passed

Re: [Numpy-discussion] indexing bug?

2007-10-03 Thread Robert Kern
Timothy Hochberg wrote: As I understand it, the whole point of PEP-357 was to allow the coercion of int-like things (numpy.int32 say, or your own private integerish class) to be used as indices without also allowing things that aren't integers, but that can be coerced to integers (floats for

Re: [Numpy-discussion] indexing bug?

2007-10-03 Thread Jarrod Millman
On 10/3/07, Timothy Hochberg [EMAIL PROTECTED] wrote: As I understand it, the whole point of PEP-357 was to allow the coercion of int-like things (numpy.int32 say, or your own private integerish class) to be used as indices without also allowing things that aren't integers, but that can be

Re: [Numpy-discussion] indexing bug?

2007-10-03 Thread Stefan van der Walt
On Wed, Oct 03, 2007 at 01:50:01PM -0400, Perry Greenfield wrote: Let me rephrase: we cannot change the API until 1.1, unless this is seen as a bug. To which other API changes are you referring? The style changes is a different matter entirely. The recent numpy and scipy threads on

[Numpy-discussion] indexing bug?

2007-09-28 Thread Nadia Dencheva
Is indexing with floats really allowed in numpy? a=numpy.array([1,2,3,4]) a[2.99] 3 Nadia Dencheva ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] indexing bug?

2007-09-28 Thread Nadia Dencheva
This should return an error and not silently truncate to int. Nadia Lou Pecora wrote: Looks like it truncates to an int. But I wouldn't do it especially if you use floating operations (+,*,/, etc.) since what you get may not truncate to the integer you expect. Remember floats are

Re: [Numpy-discussion] indexing bug?

2007-09-28 Thread Stefan van der Walt
On Fri, Sep 28, 2007 at 03:07:30PM -0400, Nadia Dencheva wrote: This should return an error and not silently truncate to int. Why do you say that? The current behaviour is consistent and well defined: a[x] == a[int(x)] We certainly can't change it now (just imagine all the code out there that