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
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?
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:
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
On Tue, Jan 31, 2012 at 13:26, Neal Becker ndbeck...@gmail.com 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
On 01/31/2012 03:07 PM, Robert Kern wrote:
On Tue, Jan 31, 2012 at 13:26, Neal Beckerndbeck...@gmail.com wrote:
I was just bitten by this unexpected behavior:
In [24]: all ([i0 for i in xrange (10)])
Out[24]: False
In [25]: all (i0 for i in xrange (10))
Out[25]: True
Turns out:
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
Dag Sverre Seljebotn wrote:
On 01/31/2012 03:07 PM, Robert Kern wrote:
On Tue, Jan 31, 2012 at 13:26, Neal Beckerndbeck...@gmail.com wrote:
I was just bitten by this unexpected behavior:
In [24]: all ([i0 for i in xrange (10)])
Out[24]: False
In [25]: all (i0 for i in xrange
Hi,
On Tue, Jan 31, 2012 at 8:29 AM, Mads Ipsen madsip...@gmail.com 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
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 for i in xrange
On Tuesday, January 31, 2012, Alan G Isaac alan.is...@gmail.com 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:
In
On Tue, Jan 31, 2012 at 15:13, Benjamin Root ben.r...@ou.edu 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(i5 for i in range(10))
array(generator
On 01/31/2012 04:13 PM, Benjamin Root wrote:
On Tuesday, January 31, 2012, Alan G Isaac alan.is...@gmail.com
mailto:alan.is...@gmail.com 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)])
On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Jan 31, 2012 at 15:13, Benjamin Root ben.r...@ou.edu 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
On 01/31/2012 04:35 PM, Benjamin Root wrote:
On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern robert.k...@gmail.com
mailto:robert.k...@gmail.com wrote:
On Tue, Jan 31, 2012 at 15:13, Benjamin Root ben.r...@ou.edu
mailto:ben.r...@ou.edu wrote:
Is np.all() using np.array() or
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
On Tue, Jan 31, 2012 at 15:35, Benjamin Root ben.r...@ou.edu wrote:
On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Jan 31, 2012 at 15:13, Benjamin Root ben.r...@ou.edu wrote:
Is np.all() using np.array() or np.asanyarray()? If the latter, I would
Le 31 janvier 2012 10:50, Robert Kern robert.k...@gmail.com a écrit :
On Tue, Jan 31, 2012 at 15:35, Benjamin Root ben.r...@ou.edu wrote:
On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern robert.k...@gmail.com
wrote:
On Tue, Jan 31, 2012 at 15:13, Benjamin Root ben.r...@ou.edu wrote:
On Tue, Jan 31, 2012 at 15:35, Benjamin Root ben.r...@ou.edu 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
On Tue, Jan 31, 2012 at 10:05 AM, Olivier Delalleau sh...@keba.be wrote:
Le 31 janvier 2012 10:50, Robert Kern robert.k...@gmail.com a écrit :
On Tue, Jan 31, 2012 at 15:35, Benjamin Root ben.r...@ou.edu wrote:
On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern robert.k...@gmail.com
wrote:
On Tue, Jan 31, 2012 at 6:33 AM, Neal Becker ndbeck...@gmail.com 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
On Tue, Jan 31, 2012 at 6:14 AM, Malcolm Reynolds
malcolm.reyno...@gmail.com 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
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,
On Tue, Jan 31, 2012 at 22:17, Travis Oliphant tra...@continuum.io 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
On Tue, Jan 31, 2012 at 4:22 PM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Jan 31, 2012 at 22:17, Travis Oliphant tra...@continuum.io
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
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
On Tue, Jan 31, 2012 at 5:35 PM, Travis Oliphant tra...@continuum.io 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
27 matches
Mail list logo