Re: [Numpy-discussion] Need faster equivalent to digitize

2010-04-14 Thread Peter Shinners
On 04/14/2010 11:34 PM, Nadav Horesh wrote: > import numpy as N > N.repeat(N.arange(len(a)), a) > >Nadav > > -Original Message- > From: numpy-discussion-boun...@scipy.org on behalf of Peter Shinners > Sent: Thu 15-Apr-10 08:30 > To: Discussion of Numerical Python > Subject: [Numpy-discu

Re: [Numpy-discussion] Need faster equivalent to digitize

2010-04-14 Thread Nadav Horesh
import numpy as N N.repeat(N.arange(len(a)), a) Nadav -Original Message- From: numpy-discussion-boun...@scipy.org on behalf of Peter Shinners Sent: Thu 15-Apr-10 08:30 To: Discussion of Numerical Python Subject: [Numpy-discussion] Need faster equivalent to digitize I am using digitiz

[Numpy-discussion] Need faster equivalent to digitize

2010-04-14 Thread Peter Shinners
I am using digitize to create a list of indices. This is giving me exactly what I want, but it's terribly slow. Digitize is obviously not the tool I want for this case, but what numpy alternative do I have? I have an array like np.array((4, 3, 3)). I need to create an index array with each inde

Re: [Numpy-discussion] Math Library

2010-04-14 Thread James Bergstra
On Tue, Apr 6, 2010 at 10:08 AM, David Cournapeau wrote: > could be put out of multiarray proper. Also, exposing an API for > things like fancy indexing would be very useful, but I don't know if > it even makes sense - I think a pure python implementation of fancy > indexing as a reference would be

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Charles R Harris
On Wed, Apr 14, 2010 at 4:39 PM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 3:12 PM, Anne Archibald > wrote: > > On 14 April 2010 16:56, Keith Goodman wrote: > >> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath > wrote: > >>> Keith Goodman writes: > On Wed, Apr 14, 2010 at 8:49 AM, K

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-14 Thread Ralf Gommers
2010/4/15 Charles سمير Doutriaux > Just downloaded this. > > On my mac 10.6, using python 2.6.5 i get: > Which download, what build command and what python/gcc versions? Looks like you're trying to build a 64-bit binary without passing in -arch x86_64 flags? Ralf > > Running from numpy so

Re: [Numpy-discussion] binomial coefficient, factorial

2010-04-14 Thread Christopher Barker
Anne Archibald wrote: >> The problem is that everyone has a different "basic". What we really >> need is an easier way for folks to use sub-packages of scipy. I've found >> myself hand-extracting just what I need, too. > > Maybe I've been spoiled by using Linux, but my answer to this sort of > thi

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 3:12 PM, Anne Archibald wrote: > On 14 April 2010 16:56, Keith Goodman wrote: >> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >>> Keith Goodman writes: On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus R

Re: [Numpy-discussion] binomial coefficient, factorial

2010-04-14 Thread Anne Archibald
On 14 April 2010 17:37, Christopher Barker wrote: > jah wrote: >> Is there any chance that a binomial coefficent and factorial function >> can make their way into NumPy? > > probably not -- numpy is over-populated already > >> I know these exist in Scipy, but I don't >> want to have to install Sci

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Anne Archibald
On 14 April 2010 16:56, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >> Keith Goodman writes: >>> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out th

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-14 Thread Stephen Simmons
I would really like to see this become a core part of numpy... For groupby-like summing over arrays, I use a modified version of numpy.bincount() which has optional arguments that greatly enhance its flexibility: bincount(bin, weights=, max_bins=. out=) where: * bins- numpy array o

Re: [Numpy-discussion] binomial coefficient, factorial

2010-04-14 Thread Christopher Barker
jah wrote: > Is there any chance that a binomial coefficent and factorial function > can make their way into NumPy? probably not -- numpy is over-populated already > I know these exist in Scipy, but I don't > want to have to install SciPy just to have something so "basic". The problem is that

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread eat
Nikolaus Rath rath.org> writes: > > Hello, > > How do I best find out the indices of the largest x elements in an > array? > > Example: > > a = [ [1,8,2], [2,1,3] ] > magic_function(a, 2) == [ (0,1), (1,2) ] > > Since the largest 2 elements are at positions (0,1) and (1,2). > > Best, > >

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 1:56 PM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >> Keith Goodman writes: >>> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best fi

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: > Keith Goodman writes: >> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: >>> On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: Hello, How do I best find out the indices of the largest x elements in an array?

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Nikolaus Rath
Keith Goodman writes: > On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: >> On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: >>> Hello, >>> >>> How do I best find out the indices of the largest x elements in an >>> array? >>> >>> Example: >>> >>> a = [ [1,8,2], [2,1,3] ] >>> magic_func

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-14 Thread Charles سمير Doutriaux
Just downloaded this. On my mac 10.6, using python 2.6.5 i get: Running from numpy source directory. non-existing path in 'numpy/distutils': 'site.cfg' F2PY Version 2 blas_opt_info: FOUND: extra_link_args = ['-Wl,-framework', '-Wl,Accelerate'] define_macros = [('NO_ATLAS_INFO', 3)]

Re: [Numpy-discussion] How to combine a pair of 1D arrays?

2010-04-14 Thread Anne Archibald
On 14 April 2010 11:34, Robert Kern wrote: > On Wed, Apr 14, 2010 at 10:25, Peter Shinners wrote: >> Is there a way to combine two 1D arrays with the same size into a 2D >> array? It seems like the internal pointers and strides could be >> combined. My primary goal is to not make any copies of th

Re: [Numpy-discussion] How to combine a pair of 1D arrays?

2010-04-14 Thread Zachary Pincus
> On Wed, Apr 14, 2010 at 10:25, Peter Shinners > wrote: >> Is there a way to combine two 1D arrays with the same size into a 2D >> array? It seems like the internal pointers and strides could be >> combined. My primary goal is to not make any copies of the data. > > There is absolutely no way t

Re: [Numpy-discussion] Is this a small bug in numpydoc?

2010-04-14 Thread Fernando Perez
On Wed, Apr 14, 2010 at 3:21 AM, Pauli Virtanen wrote: >> But I didn't write numpydoc and I'm tired, so I don't want to commit >> this without a second pair of eyes... > > Yeah, it's a bug, I think. > Thanks, fixed in r8333. Cheers, f ___ NumPy-Discus

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: >> Hello, >> >> How do I best find out the indices of the largest x elements in an >> array? >> >> Example: >> >> a = [ [1,8,2], [2,1,3] ] >> magic_function(a, 2) == [ (0,1), (1,2) ] >> >

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Gökhan Sever
On Wed, Apr 14, 2010 at 10:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out the indices of the largest x elements in an > array? > > Example: > > a = [ [1,8,2], [2,1,3] ] > magic_function(a, 2) == [ (0,1), (1,2) ] > > Since the largest 2 elements are at positions (0,1) and (1,2). >

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Keith Goodman
On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out the indices of the largest x elements in an > array? > > Example: > > a = [ [1,8,2], [2,1,3] ] > magic_function(a, 2) == [ (0,1), (1,2) ] > > Since the largest 2 elements are at positions (0,1) and (1,2). He

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Skipper Seabold
On Wed, Apr 14, 2010 at 11:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out the indices of the largest x elements in an > array? > > Example: > > a = [ [1,8,2], [2,1,3] ] > magic_function(a, 2) == [ (0,1), (1,2) ] > > Since the largest 2 elements are at positions (0,1) and (1,2). S

[Numpy-discussion] Release candidate 2 for NumPy 1.4.1 and SciPy 0.7.2

2010-04-14 Thread Ralf Gommers
Hi, I am pleased to announce the second release candidate of both Scipy 0.7.2 and NumPy 1.4.1. Please test, and report any problems on the NumPy or SciPy list. I also want to specifically ask you to report success/failure with other libraries (Matplotlib, Pygame, ) based on NumPy or SciPy. Binari

[Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Nikolaus Rath
Hello, How do I best find out the indices of the largest x elements in an array? Example: a = [ [1,8,2], [2,1,3] ] magic_function(a, 2) == [ (0,1), (1,2) ] Since the largest 2 elements are at positions (0,1) and (1,2). Best, -Niko -- »Time flies like an arrow, fruit flies like a Banana

Re: [Numpy-discussion] How to combine a pair of 1D arrays?

2010-04-14 Thread Robert Kern
On Wed, Apr 14, 2010 at 10:25, Peter Shinners wrote: > Is there a way to combine two 1D arrays with the same size into a 2D > array? It seems like the internal pointers and strides could be > combined. My primary goal is to not make any copies of the data. There is absolutely no way to get around

[Numpy-discussion] How to combine a pair of 1D arrays?

2010-04-14 Thread Peter Shinners
Is there a way to combine two 1D arrays with the same size into a 2D array? It seems like the internal pointers and strides could be combined. My primary goal is to not make any copies of the data. It might be doable with a bit of ctypes if there is not a native numpy call. >>> import numpy as

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-14 Thread Francesc Alted
A Wednesday 14 April 2010 15:36:00 Charles R Harris escrigué: > > /home/faltet/PyTables/pytables/trunk/tables/table.py:38: RuntimeWarning: > > numpy.dtype size changed, may indicate binary incompatibility > > > > I'm using current stable Cython 12.1. Is the warning above intended or > > I'm doing

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-14 Thread Charles R Harris
On Wed, Apr 14, 2010 at 7:08 AM, Francesc Alted wrote: > A Sunday 11 April 2010 11:09:53 Ralf Gommers escrigué: > > Hi, > > > > I am pleased to announce the second release candidate of both Scipy 0.7.2 > > and NumPy 1.4.1, please test them. > > > > The issues reported with rc1 should be fixed, an

Re: [Numpy-discussion] binomial coefficient, factorial

2010-04-14 Thread Alan G Isaac
On 4/13/2010 11:16 PM, jah wrote: > binomial coefficent and factorial function http://code.google.com/p/econpy/source/browse/trunk/pytrix/pytrix.py fwiw, Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mail

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-14 Thread Francesc Alted
A Sunday 11 April 2010 11:09:53 Ralf Gommers escrigué: > Hi, > > I am pleased to announce the second release candidate of both Scipy 0.7.2 > and NumPy 1.4.1, please test them. > > The issues reported with rc1 should be fixed, and for NumPy there are now > Python 2.5 binaries as well. For SciPy th

Re: [Numpy-discussion] Is this a small bug in numpydoc?

2010-04-14 Thread Pauli Virtanen
Wed, 14 Apr 2010 01:17:37 -0700, Fernando Perez wrote: [clip] > Exception occurred: > File "/home/fperez/ipython/repo/trunk-lp/docs/sphinxext/numpydoc.py", > line 71, in mangle_signature > 'initializes x; see ' in pydoc.getdoc(obj.__init__)): > AttributeError: class Bunch has no attribute '__

[Numpy-discussion] stdlib docstring format under discussion

2010-04-14 Thread Ralf Gommers
Hi all, On doc-sig there is a discussion going on about adopting a standard docstring format for the stdlib. The suggested format is epydoc. If you care about readability in a terminal then it may be good to join this discussion. http://mail.python.org/pipermail/doc-sig/2010-April/003819.html Che

Re: [Numpy-discussion] look for value, depending to y position

2010-04-14 Thread Nadav Horesh
I assume that you forgot to specify the range between 300 and 400. But anyway this piece of code may give you a direction: -- import numpy as np ythreshold = np.repeat(np.arange(4,-1,-1), 100) * 20 +190 bin_image = image > ythreshold[:,None] --

[Numpy-discussion] Is this a small bug in numpydoc?

2010-04-14 Thread Fernando Perez
Howdy, in ipython we use numpydoc, and as I was just trying to build the docs from a clean checkout of ipython's trunk, I kept getting errors that I was able to fix with this patch: amirbar[sphinxext]> svn diff Index: numpydoc.py ===

[Numpy-discussion] look for value, depending to y position

2010-04-14 Thread ioannis syntychakis
Hallo everybody maybe somebody can help with the following: i'm using numpy and pil to find objects in a grayscale image. I make an array of the image and then i look for pixels with the value above the 230. Then i convert the array to image and i see my objects. What i want is to make the grays

Re: [Numpy-discussion] how to tally the values seen

2010-04-14 Thread Peter Shinners
On 04/13/2010 11:44 PM, Gökhan Sever wrote: On Wed, Apr 14, 2010 at 1:34 AM, Warren Weckesser > wrote: Gökhan Sever wrote: > > > On Wed, Apr 14, 2010 at 1:10 AM, Peter Shinners mailto:p...@shinners.org> >