Re: [Numpy-discussion] boolean indexing change

2012-06-14 Thread Nathaniel Smith
On Mon, Jun 11, 2012 at 1:31 AM, Travis Oliphant wrote: > It is unfortunate that this was committed to master.  This should be backed > out and is a blocker for 1.7.   Can someone help me identify which commit > made the change? > > This is a rather significant change and changes the documented

Re: [Numpy-discussion] boolean indexing change

2012-06-10 Thread Travis Oliphant
It is unfortunate that this was committed to master. This should be backed out and is a blocker for 1.7. Can someone help me identify which commit made the change? This is a rather significant change and changes the documented behavior of NumPy substantially. This should definitely not o

[Numpy-discussion] boolean indexing change

2012-06-10 Thread Ralf Gommers
Something that we just ran into trying to merge a scipy PR: With 1.5.1: >>> np.arange(10)[np.array([0,1,0,1,2,3]) > 0] array([1, 3, 4, 5]) With current master: In [1]: np.arange(10)[np.array([0,1,0,1,2,3]) > 0] --- ValueError

[Numpy-discussion] boolean indexing of structured arrays

2012-06-06 Thread Benjamin Root
Not sure if this is a bug or not. I am using a fairly recent master branch. >>> # Setting up... >>> import numpy as np >>> a = np.zeros((10, 1), dtype=[('foo', 'f4'), ('bar', 'f4'), ('spam', 'f4')]) >>> a['foo'] = np.random.random((10, 1)) >>> a['bar'] = np.random.random((10, 1)) >>> a['spam'] =

[Numpy-discussion] Boolean indexing of 2d-Array not intutive

2011-10-19 Thread Till Stensitzki
Hi, for a description of the problem see here: http://stackoverflow.com/questions/7820809/understanding-weird-boolean-2d-array-indexing-behavior-in-numpy I really think, that the current way of handling two boolean indices is missleading, is there any reason behind that? greetings Till ___

Re: [Numpy-discussion] Boolean indexing

2011-03-08 Thread Robert Kern
On Tue, Mar 8, 2011 at 07:59, Sam Tygier wrote: > Hi > > I am having an  issue with boolean slicing. it seems to work fine for > reading a value, but I can use it to set a value: > > import numpy > b =  numpy.array([[1,2],[3,4],[5,6],[7,8],[9,10]]) > m = numpy.array([0,1,0,0,0], dtype=bool) > prin

Re: [Numpy-discussion] Boolean indexing

2011-03-08 Thread Sam Tygier
2011-03-08 14:29:07 GMT, Sturla Molden: >A "boolean slice" cannot be indexed with the dot product of dimensions and strides, hence the copy. >You probably want to use masked arrays instead. Masked array does not seem to help. when i do: am = numpy.ma.array(a, mask=a[n]['name']=="foo") am['x'] +=

Re: [Numpy-discussion] Boolean indexing

2011-03-08 Thread Sturla Molden
Den 08.03.2011 14:59, skrev Sam Tygier: > I think the boolean slicing is making a copy instead of a view. Yes. > is there > a way around this? A "boolean slice" cannot be indexed with the dot product of dimensions and strides, hence the copy. You probably want to use masked arrays instead. St

[Numpy-discussion] Boolean indexing

2011-03-08 Thread Sam Tygier
Hi I am having an issue with boolean slicing. it seems to work fine for reading a value, but I can use it to set a value: import numpy b = numpy.array([[1,2],[3,4],[5,6],[7,8],[9,10]]) m = numpy.array([0,1,0,0,0], dtype=bool) print b[m] print b[m][0,0] b[m][0,0] = -1 print b[m][0,0] I think th

[Numpy-discussion] boolean indexing of rank-0 arrays and scalars - ticket #721

2008-04-10 Thread Anne Archibald
Hi, Ticket #721 is titled "0-dimensional boolean arrays should work as masks for array scalars". It is not quite clear to me what the right behaviour is. We are generally trying to make zero-dimensional arrays behave the same as array scalars, but I'm not sure how that should work in this case: