Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread josef . pktd
On Tue, Jan 31, 2012 at 5:35 PM, Travis Oliphant wrote: > Actually i believe the NumPy 'any' and 'all' names pre-date the Python usage > which first appeared in Python 2.5 > > I agree with Chris that namespaces are a great idea.  I don't agree with > deprecating 'any' and 'all' I completely agr

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Travis Oliphant
Actually i believe the NumPy 'any' and 'all' names pre-date the Python usage which first appeared in Python 2.5 I agree with Chris that namespaces are a great idea. I don't agree with deprecating 'any' and 'all' It also seems useful to revisit under what conditions 'array' could correctly int

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Warren Weckesser
On Tue, Jan 31, 2012 at 4:22 PM, Robert Kern wrote: > On Tue, Jan 31, 2012 at 22:17, Travis Oliphant > wrote: > > I also agree that an exception should be raised at the very least. > > > > It might also be possible to make the NumPy any, all, and sum functions > > behave like the builtins when g

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Robert Kern
On Tue, Jan 31, 2012 at 22:17, Travis Oliphant wrote: > I also agree that an exception should be raised at the very least. > > It might also be possible to make the NumPy any, all, and sum functions > behave like the builtins when given a generator.  It seems worth exploring > at least. I would r

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Travis Oliphant
I also agree that an exception should be raised at the very least. It might also be possible to make the NumPy any, all, and sum functions behave like the builtins when given a generator. It seems worth exploring at least. Travis -- Travis Oliphant (on a mobile) 512-826-7480 On Jan 31, 2012

Re: [Numpy-discussion] Unexpected reorganization of internal data

2012-01-31 Thread Chris Barker
On Tue, Jan 31, 2012 at 6:14 AM, Malcolm Reynolds wrote: > Not exactly an answer to your question, but I can highly recommend > using Boost.python, PyUblas and Ublas for your C++ vectors and > matrices. It gives you a really good interface on the C++ side to > numpy arrays and matrices, which can

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Chris Barker
On Tue, Jan 31, 2012 at 6:33 AM, Neal Becker wrote: > The reason it surprised me, is that python 'all' doesn't behave as numpy 'all' > in this respect - and using ipython, I didn't even notice that 'all' was > numpy.all rather than standard python all. "namespaces are one honking great idea" --

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Benjamin Root
On Tue, Jan 31, 2012 at 10:05 AM, Olivier Delalleau wrote: > Le 31 janvier 2012 10:50, Robert Kern a écrit : > >> On Tue, Jan 31, 2012 at 15:35, Benjamin Root wrote: >> > >> > >> > On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern >> wrote: >> >> >> >> On Tue, Jan 31, 2012 at 15:13, Benjamin Root

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Robert Kern
On Tue, Jan 31, 2012 at 15:35, Benjamin Root wrote: > Furthermore, from the documentation: > > numpy.asanyarray = asanyarray(a, dtype=None, order=None, maskna=None, > ownmaskna=False) > Convert the input to an ndarray, but pass ndarray subclasses through. > > Parameters > -

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Olivier Delalleau
Le 31 janvier 2012 10:50, Robert Kern a écrit : > On Tue, Jan 31, 2012 at 15:35, Benjamin Root wrote: > > > > > > On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern > wrote: > >> > >> On Tue, Jan 31, 2012 at 15:13, Benjamin Root wrote: > >> > >> > Is np.all() using np.array() or np.asanyarray()? If

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Robert Kern
On Tue, Jan 31, 2012 at 15:35, Benjamin Root wrote: > > > On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern wrote: >> >> On Tue, Jan 31, 2012 at 15:13, Benjamin Root wrote: >> >> > Is np.all() using np.array() or np.asanyarray()?  If the latter, I would >> > expect it to return a numpy array from a g

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Alan G Isaac
On 1/31/2012 10:35 AM, Benjamin Root wrote: > A generator is an input that could be converted into an array. def mygen(): i = 0 while True: yield i i += 1 Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://m

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Dag Sverre Seljebotn
On 01/31/2012 04:35 PM, Benjamin Root wrote: > > > On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern > wrote: > > On Tue, Jan 31, 2012 at 15:13, Benjamin Root > wrote: > > > Is np.all() using np.array() or np.asanyarray()? If the latt

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Benjamin Root
On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern wrote: > On Tue, Jan 31, 2012 at 15:13, Benjamin Root wrote: > > > Is np.all() using np.array() or np.asanyarray()? If the latter, I would > > expect it to return a numpy array from a generator. > > Why would you expect that? > > [~/scratch] > |37> n

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Dag Sverre Seljebotn
On 01/31/2012 04:13 PM, Benjamin Root wrote: > > > On Tuesday, January 31, 2012, Alan G Isaac > wrote: > > On 1/31/2012 8:26 AM, Neal Becker wrote: > >> I was just bitten by this unexpected behavior: > >> > >> In [24]: all ([i> 0 for i in xrange (10)]) > >> Out[

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Robert Kern
On Tue, Jan 31, 2012 at 15:13, Benjamin Root wrote: > Is np.all() using np.array() or np.asanyarray()?  If the latter, I would > expect it to return a numpy array from a generator. Why would you expect that? [~/scratch] |37> np.asanyarray(i>5 for i in range(10)) array( at 0xdc24a08>, dtype=obje

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Benjamin Root
On Tuesday, January 31, 2012, Alan G Isaac wrote: > On 1/31/2012 8:26 AM, Neal Becker wrote: >> I was just bitten by this unexpected behavior: >> >> In [24]: all ([i> 0 for i in xrange (10)]) >> Out[24]: False >> >> In [25]: all (i> 0 for i in xrange (10)) >> Out[25]: True >> >> Turns out: >>

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Alan G Isaac
On 1/31/2012 8:26 AM, Neal Becker wrote: > I was just bitten by this unexpected behavior: > > In [24]: all ([i> 0 for i in xrange (10)]) > Out[24]: False > > In [25]: all (i> 0 for i in xrange (10)) > Out[25]: True > > Turns out: > In [31]: all is numpy.all > Out[31]: True >>> np.array([i> 0

Re: [Numpy-discussion] Unexpected reorganization of internal data

2012-01-31 Thread Matthew Brett
Hi, On Tue, Jan 31, 2012 at 8:29 AM, Mads Ipsen wrote: > Hi, > > I am confused. Here's the reason: > > The following structure is a representation of N points in 3D space: > > U = numpy.array([[x1,y1,z1], [x1,y1,z1],...,[xn,yn,zn]]) > > So the array U has shape (N,3). This order makes sense to me

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Neal Becker
Dag Sverre Seljebotn wrote: > On 01/31/2012 03:07 PM, Robert Kern wrote: >> On Tue, Jan 31, 2012 at 13:26, Neal Becker wrote: >>> I was just bitten by this unexpected behavior: >>> >>> In [24]: all ([i>0 for i in xrange (10)]) >>> Out[24]: False >>> >>> In [25]: all (i>0 for i in xrange (

Re: [Numpy-discussion] Unexpected reorganization of internal data

2012-01-31 Thread Malcolm Reynolds
Not exactly an answer to your question, but I can highly recommend using Boost.python, PyUblas and Ublas for your C++ vectors and matrices. It gives you a really good interface on the C++ side to numpy arrays and matrices, which can be passed in both directions over the language threshold with no c

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Dag Sverre Seljebotn
On 01/31/2012 03:07 PM, Robert Kern wrote: > On Tue, Jan 31, 2012 at 13:26, Neal Becker wrote: >> I was just bitten by this unexpected behavior: >> >> In [24]: all ([i>0 for i in xrange (10)]) >> Out[24]: False >> >> In [25]: all (i>0 for i in xrange (10)) >> Out[25]: True >> >> Turns out:

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Robert Kern
On Tue, Jan 31, 2012 at 13:26, Neal Becker wrote: > I was just bitten by this unexpected behavior: > > In [24]: all ([i>  0 for i in xrange (10)]) > Out[24]: False > > In [25]: all (i>  0 for i in xrange (10)) > Out[25]: True > > Turns out: > In [31]: all is numpy.all > Out[31]: True > > So numpy.

[Numpy-discussion] Unexpected reorganization of internal data

2012-01-31 Thread Mads Ipsen
Hi, I am confused. Here's the reason: The following structure is a representation of N points in 3D space: U = numpy.array([[x1,y1,z1], [x1,y1,z1],...,[xn,yn,zn]]) So the array U has shape (N,3). This order makes sense to me since U[i] will give you the i'th point in the set. Now, I want to p

Re: [Numpy-discussion] histogram help

2012-01-31 Thread Nadav Horesh
Do you want a histogramm of z for each (x,y) ? Nadav From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] On Behalf Of Ruby Stevenson [ruby...@gmail.com] Sent: 30 January 2012 21:27 To: Discussion of Numerical Python Subject: R

[Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Neal Becker
I was just bitten by this unexpected behavior: In [24]: all ([i> 0 for i in xrange (10)]) Out[24]: False In [25]: all (i> 0 for i in xrange (10)) Out[25]: True Turns out: In [31]: all is numpy.all Out[31]: True So numpy.all doesn't seem to do what I would expect when given a generator. Bug?

[Numpy-discussion] [ANN] Summer School "Advanced Scientific Programming in Python" in Kiel, Germany

2012-01-31 Thread Tiziano Zito
Advanced Scientific Programming in Python = a Summer School by the G-Node and the Institute of Experimental and Applied Physics, Christian-Albrechts-Universität zu Kiel Scientists spend more and more time writing, maintaining, and debugging software. While t