[Numpy-discussion] How can I install numpy on Python 3.1 in Ubuntu?

2011-01-24 Thread cool-RR
Hello folks, I have Ubuntu 10.10 server on EC2. I installed Python 3.1, and now I want to install NumPy on it. How do I do it? I tried `easy_install-3.1 numpy` but got this error: [...] RefactoringTool: Refactored /tmp/easy_install-MiUli2/numpy-1.5.1/build/py3k/numpy/core/defchararray.py

Re: [Numpy-discussion] How can I install numpy on Python 3.1 in Ubuntu?

2011-01-24 Thread Ralf Gommers
On Mon, Jan 24, 2011 at 8:22 PM, cool-RR cool...@cool-rr.com wrote: Hello folks, I have Ubuntu 10.10 server on EC2. I installed Python 3.1, and now I want to install NumPy on it. How do I do it? I tried `easy_install-3.1 numpy` but got this error: Just do python3.1 setup.py install. That's

[Numpy-discussion] need a better way to fill a grid

2011-01-24 Thread John
Hello, I'm trying to cycle over some vectors (lat,lon,emissions) of irregularly spaced lat/lon spots, and values. I need to sum the values each contributing to grid on a regular lat lon grid. This is what I have presently, but it is too slow. Is there a more efficient way to do this? I would

Re: [Numpy-discussion] need a better way to fill a grid

2011-01-24 Thread David Huard
Hi John, Since you have a regular grid, you should be able to find the x and y indices without np.where, ie something like I = (lon-grid.outlon0 / grid.dx).astype(int) J = (lat-grid.outlat0 / grid.dy).astype(int) for i, j, e in zip(I, J, emissions): Z[i,j] += e David On Mon, Jan 24, 2011

Re: [Numpy-discussion] need a better way to fill a grid

2011-01-24 Thread Vincent Schut
On 01/24/2011 02:53 PM, John wrote: Hello, I'm trying to cycle over some vectors (lat,lon,emissions) of irregularly spaced lat/lon spots, and values. I need to sum the values each contributing to grid on a regular lat lon grid. This is what I have presently, but it is too slow. Is there a

Re: [Numpy-discussion] need a better way to fill a grid

2011-01-24 Thread John
I know we're not supposed to 'broadcast' thanks, but Thanks! This works much more efficiently! On Mon, Jan 24, 2011 at 3:50 PM, David Huard david.hu...@gmail.com wrote: Hi John, Since you have a regular grid, you should be able to find the x and y indices without np.where, ie something like

Re: [Numpy-discussion] need a better way to fill a grid

2011-01-24 Thread John
I will try this as well and report back with a timing... On Mon, Jan 24, 2011 at 3:56 PM, Vincent Schut sc...@sarvision.nl wrote: On 01/24/2011 02:53 PM, John wrote: Hello, I'm trying to cycle over some vectors (lat,lon,emissions) of irregularly spaced lat/lon spots, and values. I need to

Re: [Numpy-discussion] need a better way to fill a grid

2011-01-24 Thread John
Thanks again everyone, Just for completeness. First, there seems to be a problem with my original method, but it must have to do with indexing. Apart from being slow, it reports back maximum values a factor of two greater than the other two methods, so something is amiss there. The other two

[Numpy-discussion] Numexpr giving randomized results on arrays larger than 2047 elements

2011-01-24 Thread John Salvatier
Hello, I have discovered a strange bug with numexpr. numexpr.evaluate gives randomized results on arrays larger than 2047 elements. The following program demonstrates this: from numpy import * from numexpr import evaluate def func(x): return evaluate(sum(x, axis = 0)) x = zeros(2048)+.01

Re: [Numpy-discussion] Numexpr giving randomized results on arrays larger than 2047 elements

2011-01-24 Thread John Salvatier
Forgot to mention that I am using numexpr 1.4.1 and numpy 1.5.1 On Mon, Jan 24, 2011 at 9:47 AM, John Salvatier jsalv...@u.washington.eduwrote: Hello, I have discovered a strange bug with numexpr. numexpr.evaluate gives randomized results on arrays larger than 2047 elements. The following

Re: [Numpy-discussion] Numexpr giving randomized results on arrays larger than 2047 elements

2011-01-24 Thread totonixs...@gmail.com
I have the same problem here. I'm using numexpr 1.4.1 and numpy 1.3.0. On Mon, Jan 24, 2011 at 4:19 PM, John Salvatier jsalv...@u.washington.edu wrote: Forgot to mention that I am using numexpr 1.4.1 and numpy 1.5.1 On Mon, Jan 24, 2011 at 9:47 AM, John Salvatier jsalv...@u.washington.edu

Re: [Numpy-discussion] Numexpr giving randomized results on arrays larger than 2047 elements

2011-01-24 Thread Warren Weckesser
I see the same randomness, but at a different array size: In [23]: numpy.__version__ Out[23]: '1.4.0' In [24]: import numexpr In [25]: numexpr.__version__ Out[25]: '1.4.1' In [26]: x = zeros(8192)+0.01 In [27]: print evaluate('sum(x, axis=0)') 72.97 In [28]: print evaluate('sum(x, axis=0)')

Re: [Numpy-discussion] Numexpr giving randomized results on arrays larger than 2047 elements

2011-01-24 Thread John Salvatier
I also get the same issue with prod() On Mon, Jan 24, 2011 at 10:23 AM, Warren Weckesser warren.weckes...@enthought.com wrote: I see the same randomness, but at a different array size: In [23]: numpy.__version__ Out[23]: '1.4.0' In [24]: import numexpr In [25]: numexpr.__version__

Re: [Numpy-discussion] Numexpr giving randomized results on arrays larger than 2047 elements

2011-01-24 Thread John Salvatier
Looks like this is related to issue 41 ( http://code.google.com/p/numexpr/issues/detail?id=41can=1). On Mon, Jan 24, 2011 at 10:29 AM, John Salvatier jsalv...@u.washington.eduwrote: I also get the same issue with prod() On Mon, Jan 24, 2011 at 10:23 AM, Warren Weckesser

Re: [Numpy-discussion] Numexpr giving randomized results on arrays larger than 2047 elements

2011-01-24 Thread Warren Weckesser
On Mon, Jan 24, 2011 at 1:13 PM, John Salvatier jsalv...@u.washington.eduwrote: Looks like this is related to issue 41 ( http://code.google.com/p/numexpr/issues/detail?id=41can=1). That might not be the same issue. You can fix the randomness by setting the number of threads to 1, as in

[Numpy-discussion] How to improve performance of slow tri*_indices calculations?

2011-01-24 Thread eat
Hi, Running on: In []: np.__version__ Out[]: '1.5.1' In []: sys.version Out[]: '2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]' For the reference: In []: X= randn(10, 125) In []: timeit dot(X.T, X) 1 loops, best of 3: 170 us per loop In []: X= randn(10, 250) In []:

[Numpy-discussion] bug in genfromtxt with missing values?

2011-01-24 Thread Skipper Seabold
Am I misreading the docs or missing something? Consider the following adapted from here: http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html from StringIO import StringIO import numpy as np data = 1, 2, 3\n4, ,5 np.genfromtxt(StringIO(data), delimiter=,, names=a,b,c, missing_values=

Re: [Numpy-discussion] How to improve performance of slow tri*_indices calculations?

2011-01-24 Thread josef . pktd
On Mon, Jan 24, 2011 at 4:29 PM, eat e.antero.ta...@gmail.com wrote: Hi, Running on: In []: np.__version__ Out[]: '1.5.1' In []: sys.version Out[]: '2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]' For the reference: In []: X= randn(10, 125) In []: timeit dot(X.T,

Re: [Numpy-discussion] How to improve performance of slow tri*_indices calculations?

2011-01-24 Thread josef . pktd
On Mon, Jan 24, 2011 at 6:49 PM, josef.p...@gmail.com wrote: On Mon, Jan 24, 2011 at 4:29 PM, eat e.antero.ta...@gmail.com wrote: Hi, Running on: In []: np.__version__ Out[]: '1.5.1' In []: sys.version Out[]: '2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]' For