Re: [Numpy-discussion] Optimized half-sizing of images?

2009-08-07 Thread Sebastian Haase
On Fri, Aug 7, 2009 at 3:46 AM, Zachary Pincuszachary.pin...@yale.edu wrote: We have a need to to generate half-size version of RGB images as quickly as possible. How good do these need to look? You could just throw away every other pixel... image[::2, ::2]. Failing that, you could also

Re: [Numpy-discussion] Fwd: GPU Numpy

2009-08-07 Thread Romain Brette
Sturla Molden a écrit : Thus, here is my plan: 1. a special context-manager class 2. immutable arrays inside with statement 3. lazy evaluation: expressions build up a parse tree 4. dynamic code generation 5. evaluation on exit There seems to be some similarity with what we want to do to

Re: [Numpy-discussion] Strange Error with NumPy Addendum

2009-08-07 Thread Nanime Puloski
But if it were an unsigned int64, it should be able to hold 2**64 or at least 2**64-1. Am I correct? On Fri, Aug 7, 2009 at 1:03 AM, David Warde-Farley d...@cs.toronto.eduwrote: On 6-Aug-09, at 7:29 PM, Robert Kern wrote: For that value, yes, but not for long objects in general. We don't

[Numpy-discussion] Test failures for rev7299

2009-08-07 Thread Christopher Hanley
Hi, I receive the following test errors after building numpy rev7229 from svn: == FAIL: test_simple_circular (test_multiarray.TestStackedNeighborhoodIter) --

Re: [Numpy-discussion] Test failures for rev7299

2009-08-07 Thread David Cournapeau
Christopher Hanley wrote: Hi, I receive the following test errors after building numpy rev7229 from svn: Yep, a bug slipped in the last commit, I am fixing it right now, David ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Optimized half-sizing of images?

2009-08-07 Thread Christopher Barker
Zachary Pincus wrote: We have a need to to generate half-size version of RGB images as quickly as possible. How good do these need to look? You could just throw away every other pixel... image[::2, ::2]. I do the as good quality as I can get. throwing away pixels gets a bit ugly.

[Numpy-discussion] Vectorize ufunc

2009-08-07 Thread T J
I was wondering why vectorize doesn't make the ufunc available at the topmost level def a(x,y): return x + y b = vectorize(a) b.reduce Instead, the ufunc is stored at b.ufunc. Also, b.ufunc.reduce() doesn't seem to exist until I *use* the vectorized function at least once. Can this be

[Numpy-discussion] Power distribution

2009-08-07 Thread alan
Documenting my way through the statistics modules in numpy, I ran into the Power Distribution. Anyone know what that is? I Googled for it, and found a lot of stuff on electricity, but no reference for a statistical distribution of that name. Does it have a common alias? --

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread Andrew Hawryluk
You might get better results for 'power-law distribution' http://en.wikipedia.org/wiki/Power_law Andrew -Original Message- From: numpy-discussion-boun...@scipy.org [mailto:numpy-discussion- boun...@scipy.org] On Behalf Of a...@ajackson.org Sent: 7 Aug 2009 11:45 AM To: Discussion of

[Numpy-discussion] memmap capability

2009-08-07 Thread Tom Kuiper
If this appears twice, forgive me. I sent it previously (7:13 am PDT) via a browser interface to JPL's Office Outlook. I have doubts about this system. This time, from Iceweasel through our SMTP server. There are two things I'd like to do using memmap. I suspect that they are impossible

[Numpy-discussion] reduce function of vectorize doesn't respect dtype?

2009-08-07 Thread T J
The reduce function of ufunc of a vectorized function doesn't seem to respect the dtype. def a(x,y): return x+y b = vectorize(a) c = array([1,2]) b(c, c) # use once to populate b.ufunc d = b.ufunc.reduce(c) c.dtype, type(d) dtype('int32'), type 'int' c = array([[1,2,3],[4,5,6]])

Re: [Numpy-discussion] Vectorize ufunc

2009-08-07 Thread Travis Oliphant
The short answer is that it was easier this way. The ufunc is created on the fly and it needs to know several things that are easy to get once the function is called. Sent from my iPhone On Aug 7, 2009, at 11:42 AM, T J tjhn...@gmail.com wrote: I was wondering why vectorize doesn't make

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread alan
I don't think that is it, since the one in numpy has a range restricted to the interval 0-1. Try out hist(np.random.power(5, 100), bins=100) You might get better results for 'power-law distribution' http://en.wikipedia.org/wiki/Power_law Andrew -Original Message- From:

[Numpy-discussion] dot documentation

2009-08-07 Thread T J
Hi, the documentation for dot says that a value error is raised if: If the last dimension of a is not the same size as the second-to-last dimension of b. (http://docs.scipy.org/doc/numpy/reference/generated/numpy.dot.htm) This doesn't appear to be the case: a = array([[1,2],[3,4]]) b =

Re: [Numpy-discussion] dot documentation

2009-08-07 Thread T J
Oh. b.shape = (2,). So I suppose the second to last dimension is, in fact, the last dimension...and 2 == 2. nvm On Fri, Aug 7, 2009 at 2:19 PM, T Jtjhn...@gmail.com wrote: Hi,  the documentation for dot says that a value error is raised if:    If the last dimension of a is not the same size

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread Andrew Hawryluk
Hmm ... good point. It appears to give a probability distribution proportional to x**(a-1), but I see no good reason why the domain should be limited to [0,1]. def test(a): nums = plt.hist(np.random.power(a,10),bins=100,ec='none',fc='#dd') x = np.linspace(0,1,200)

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread josef . pktd
On Fri, Aug 7, 2009 at 5:25 PM, Andrew Hawrylukhawr...@novachem.com wrote: Hmm ... good point. It appears to give a probability distribution proportional to x**(a-1), but I see no good reason why the domain should be limited to [0,1]. def test(a):    nums =

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread josef . pktd
On Fri, Aug 7, 2009 at 5:42 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:25 PM, Andrew Hawrylukhawr...@novachem.com wrote: Hmm ... good point. It appears to give a probability distribution proportional to x**(a-1), but I see no good reason why the domain should be limited to [0,1].

Re: [Numpy-discussion] dot documentation

2009-08-07 Thread Charles R Harris
On Fri, Aug 7, 2009 at 3:24 PM, T J tjhn...@gmail.com wrote: Oh. b.shape = (2,). So I suppose the second to last dimension is, in fact, the last dimension...and 2 == 2. nvm On Fri, Aug 7, 2009 at 2:19 PM, T Jtjhn...@gmail.com wrote: Hi, the documentation for dot says that a value error

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread josef . pktd
On Fri, Aug 7, 2009 at 6:13 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:42 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:25 PM, Andrew Hawrylukhawr...@novachem.com wrote: Hmm ... good point. It appears to give a probability distribution proportional to x**(a-1), but I

Re: [Numpy-discussion] Optimized half-sizing of images?

2009-08-07 Thread Christopher Barker
To finish off the thread for posterity: Robert Bradshaw wrote: Robert's Cython code clipped. Robert's version operated on a 2-d array, so only one band at a time if you have RGB. So I edited it a bit: import cython import numpy as np cimport numpy as np @cython.boundscheck(False) def

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread josef . pktd
On Fri, Aug 7, 2009 at 6:57 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 6:13 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:42 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:25 PM, Andrew Hawrylukhawr...@novachem.com wrote: Hmm ... good point. It appears to give

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread josef . pktd
On Fri, Aug 7, 2009 at 8:54 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 6:57 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 6:13 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:42 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:25 PM, Andrew

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread alan
Thanks! That helps a lot. On Fri, Aug 7, 2009 at 8:54 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 6:57 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 6:13 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:42 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:25

[Numpy-discussion] numpy.random.pareto, m equal zero

2009-08-07 Thread josef . pktd
Does it make any (statistical) sense to have numpy.random.pareto produce random numbers that start at zero? Can we change it to start at 1 which is the usual default? Notation from http://docs.scipy.org/numpy/docs/numpy.random.mtrand.RandomState.pareto/ The probability density for the

[Numpy-discussion] Merging datetime, Yes or No

2009-08-07 Thread Charles R Harris
I ask again, Datetime is getting really stale and hasn't been touched recently. Do the datetime folks want it merged or not, because it's getting to be a bit of work. Chuck ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Power distribution

2009-08-07 Thread josef . pktd
On Fri, Aug 7, 2009 at 10:17 PM, a...@ajackson.org wrote: Thanks! That helps a lot. Thanks for improving the docs. On Fri, Aug 7, 2009 at 8:54 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 6:57 PM, josef.p...@gmail.com wrote: On Fri, Aug 7, 2009 at 6:13 PM, josef.p...@gmail.com

[Numpy-discussion] How to preserve number of array dimensions when taking a slice?

2009-08-07 Thread Dr. Phillip M. Feldman
I'd like to be able to make a slice of a 3-dimensional array, doing something like the following: Y= X[A, B, C] where A, B, and C are lists of indices. This works, but has an unexpected side-effect. When A, B, or C is a length-1 list, Y has fewer dimensions than X. Is there a way to do the