[Numpy-discussion] [ANN] carray 0.2: an in-memory compressed data container

2010-08-27 Thread Francesc Alted
= Announcing carray 0.2 = What it is == carray is a container for numerical data that can be compressed in-memory. The compresion process is carried out internally by Blosc, a high-performance compressor that is optimized for binary data. Having

[Numpy-discussion] Boolean arrays

2010-08-27 Thread Brett Olsen
Hello, I have an array of non-numeric data, and I want to create a boolean array denoting whether each element in this array is a valid value or not. This is straightforward if there's only one possible valid value: import numpy as N ar = N.array((a, b, c, b, b, a, d, c, a)) ar == a array([

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Ken Watford
On Fri, Aug 27, 2010 at 3:58 PM, Brett Olsen brett.ol...@gmail.com wrote: Hello, I have an array of non-numeric data, and I want to create a boolean array denoting whether each element in this array is a valid value or not.  This is straightforward if there's only one possible valid value:

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Robert Kern
On Fri, Aug 27, 2010 at 15:10, Ken Watford kwatford+sc...@gmail.com wrote: On Fri, Aug 27, 2010 at 3:58 PM, Brett Olsen brett.ol...@gmail.com wrote: Hello, I have an array of non-numeric data, and I want to create a boolean array denoting whether each element in this array is a valid value

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Nathaniel Smith
On Fri, Aug 27, 2010 at 1:17 PM, Robert Kern robert.k...@gmail.com wrote: But in any case, that would be very slow for large arrays since it would invoke a Python function call for every value in ar. Instead, iterate over the valid array, which is much shorter: mask = np.zeros(ar.shape,

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Anne Archibald
On 27 August 2010 16:17, Robert Kern robert.k...@gmail.com wrote: On Fri, Aug 27, 2010 at 15:10, Ken Watford kwatford+sc...@gmail.com wrote: On Fri, Aug 27, 2010 at 3:58 PM, Brett Olsen brett.ol...@gmail.com wrote: Hello, I have an array of non-numeric data, and I want to create a boolean

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Ken Watford
On Fri, Aug 27, 2010 at 4:17 PM, Robert Kern robert.k...@gmail.com wrote: On Fri, Aug 27, 2010 at 15:10, Ken Watford kwatford+sc...@gmail.com wrote: On Fri, Aug 27, 2010 at 3:58 PM, Brett Olsen brett.ol...@gmail.com wrote: Hello, I have an array of non-numeric data, and I want to create a

Re: [Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

2010-08-27 Thread David Huard
Nils and Joseph, Thanks for the bug report, this is now fixed in SVN (r8672). Ralph. is this something that you want to see backported in 1.5 ? Regards, David On Fri, Aug 6, 2010 at 7:49 PM, josef.p...@gmail.com wrote: On Fri, Aug 6, 2010 at 4:53 PM, Nils Becker n.bec...@amolf.nl wrote:

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Robert Kern
On Fri, Aug 27, 2010 at 15:21, Nathaniel Smith n...@pobox.com wrote: On Fri, Aug 27, 2010 at 1:17 PM, Robert Kern robert.k...@gmail.com wrote: But in any case, that would be very slow for large arrays since it would invoke a Python function call for every value in ar. Instead, iterate over the

Re: [Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

2010-08-27 Thread Robert Kern
On Fri, Aug 27, 2010 at 15:32, David Huard david.hu...@gmail.com wrote: Nils and Joseph, Thanks for the bug report, this is now fixed in SVN (r8672). While we're at it, can we change the name of the argument? normed has caused so much confusion over the years. We could deprecate normed=True in

[Numpy-discussion] bincount() optional length argument

2010-08-27 Thread David Warde-Farley
I've been using bincount() in situations where I always want the count vector to be a certain fixed length, even if the upper bins are 0. e.g. I want the counts of 0 through 9, and if there are no 9's in the vector I'm counting, I'd still like it to be at least length 10. It's kind of a pain to

Re: [Numpy-discussion] bincount() optional length argument

2010-08-27 Thread Robert Kern
On Fri, Aug 27, 2010 at 16:13, David Warde-Farley d...@cs.toronto.edu wrote: I've been using bincount() in situations where I always want the count vector to be a certain fixed length, even if the upper bins are 0. e.g. I want the counts of 0 through 9, and if there are no 9's in the vector

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Nathaniel Smith
On Fri, Aug 27, 2010 at 1:35 PM, Robert Kern robert.k...@gmail.com wrote: [~] |8 %timeit kern_in(ar, valid) 10 loops, best of 3: 115 ms per loop [~] |9 %timeit np.in1d(ar, valid) 1 loops, best of 3: 279 ms per loop As valid gets larger, in1d() will catch up but for smallish sizes of

Re: [Numpy-discussion] bincount() optional length argument

2010-08-27 Thread David Warde-Farley
On 2010-08-27, at 5:15 PM, Robert Kern wrote: How would people feel about an optional argument to support this behaviour? I'd be happy with either a minlength or an exactly this length with values above this range being ignored, but it seems like the latter might be useful in more cases.

Re: [Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

2010-08-27 Thread Charles R Harris
On Fri, Aug 27, 2010 at 2:47 PM, Robert Kern robert.k...@gmail.com wrote: On Fri, Aug 27, 2010 at 15:32, David Huard david.hu...@gmail.com wrote: Nils and Joseph, Thanks for the bug report, this is now fixed in SVN (r8672). While we're at it, can we change the name of the argument? normed