Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Karol Langner
On Friday 05 of January 2007 19:29, Matt Knox wrote: > > On Friday 05 of January 2007 17:42, Matt Knox wrote: > > > - > > > Example 1 - exponential moving average: > > > > > > # naive brute force method... > > > def expmave(x, k): > > > result = numpy

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Matt Knox
> Are you sure about this? I ran this case using timeit, and the first one > was 5 times or so *faster* than the second case. I just dug around and > frompyfunc is acutally implemented in C, although it has to call back > into python to execute the function being vectorized. Can you try using >

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Tim Hochberg
Christopher Barker wrote: [SNIP] > I think the PEP has far more chances of success if it's seen as a > request from a variety of package developers, not just the numpy crowd > (which, after all, already has numpy This seems eminently sensible. Getting a few developers from other projects on boa

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Tim Hochberg
Matt Knox wrote: >>> You might want to look at frompyfunc: >>> >>> def expmave2(x, k): >>> def expmave_sub(a, b): >>> return a + k * (b - a) >>> return np.frompyfunc(expmave_sub, 2, 1).accumulate(x) >>> >>> >>> It's amazing wha

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Matt Knox
> >> > > You might want to look at frompyfunc: > > > > def expmave2(x, k): > > def expmave_sub(a, b): > > return a + k * (b - a) > > return np.frompyfunc(expmave_sub, 2, 1).accumulate(x) > > > > > > It's amazing what you find when you dig around.

Re: [Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-05 Thread Sebastian Haase
package header would usually be found in PREFIX/include/python2.x (with PREFIX being something like: /usr/lib/python24 or C:/python24 ) However for obscure reasons in numpy the header files are in PREFIX/lib/python2.x/site-packages/numpy/core You have to "somehow" add this as '-I ' to your

Re: [Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-05 Thread Robert Kern
belinda thom wrote: > On Jan 5, 2007, at 5:32 PM, Sebastian Haase wrote: > >> Hi, >> All I did is recompiling my (on source code file) C extension. I made >> sure that it was including the current numpy header files. > > Where are these files located? What command did you use? (The gorey > deta

Re: [Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-05 Thread belinda thom
On Jan 5, 2007, at 5:32 PM, Sebastian Haase wrote: > Hi, > All I did is recompiling my (on source code file) C extension. I made > sure that it was including the current numpy header files. Where are these files located? What command did you use? (The gorey details would help me quite a bit, a

Re: [Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-05 Thread Sebastian Haase
Hi, All I did is recompiling my (on source code file) C extension. I made sure that it was including the current numpy header files. I did not use anything related to distutils ( no "python setup.py ..." ). Does that answer your question ? -Sebastian On 1/5/07, belinda thom <[EMAIL PROTECTED]>

[Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-05 Thread belinda thom
Sebastian, I had the same problem awhile back; I'm curious---how'd you fix your mismatch (i.e. where'd you go to get code, did you run python setup?, ...). I realize these are very basic questions, but I've never installed anything from source (aside from using easy_install), so it would b

Re: [Numpy-discussion] x[None] changes x.shape

2007-01-05 Thread Robert Kern
Vincent Nijs wrote: > Say I use a function that expects a boolean array called sel to be passed as > an argument: > > def foo(x,sel = None): > return x[sel] > > If x is a 1-d array and sel is a (1-d) boolean array, x.shape will give (n,) > where n is len(x). > > However, if the default value

[Numpy-discussion] x[None] changes x.shape

2007-01-05 Thread Vincent Nijs
Say I use a function that expects a boolean array called sel to be passed as an argument: def foo(x,sel = None): return x[sel] If x is a 1-d array and sel is a (1-d) boolean array, x.shape will give (n,) where n is len(x). However, if the default value None is used (i.e., when no boolean arr

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Travis Oliphant
Tim Hochberg wrote: >A. M. Archibald wrote: > > >[SNIP] > > >>Really it would be nice if what vectorize() returned were effectively >>a ufunc, supporting all the various operations we might want from a >>ufunc (albeit inefficiently). This should not be difficult, but I am >>not up to writing it

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Tim Hochberg
Tim Hochberg wrote: > A. M. Archibald wrote: > > > [SNIP] > >> Really it would be nice if what vectorize() returned were effectively >> a ufunc, supporting all the various operations we might want from a >> ufunc (albeit inefficiently). This should not be difficult, but I am >> not up to writing

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Tim Hochberg
A. M. Archibald wrote: [SNIP] > > Really it would be nice if what vectorize() returned were effectively > a ufunc, supporting all the various operations we might want from a > ufunc (albeit inefficiently). This should not be difficult, but I am > not up to writing it this evening. > You might

Re: [Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-05 Thread Sebastian Haase
You are right again, of course ! Sorry for the noise - I should have just checked the date of my so file (which is August 15) At least I understood the "official numpy intention of version 1.0" right then - just checking ... Thanks, Sebastian. On 1/5/07, Robert Kern <[EMAIL PROTECTED]> wrote: >

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread A. M. Archibald
On 05/01/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > On 1/5/07, Tim Hochberg <[EMAIL PROTECTED]> wrote: > > Matt Knox wrote: > > > Basically, I'd like to be able to do accumulate operations with custom > functions. numpy.vectorize does not seem to provide an accumulate method > with the func

Re: [Numpy-discussion] discussion about array.resize() -- compare to numarray

2007-01-05 Thread Sebastian Haase
On 1/5/07, Russell E Owen <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > "Sebastian Haase" <[EMAIL PROTECTED]> wrote: > > > On 1/4/07, Sebastian Haase <[EMAIL PROTECTED]> wrote: > > > > > >>> N.__version__ > > > '1.0.2.dev3487' > > > > > > in any case: inside the script it some

Re: [Numpy-discussion] discussion about array.resize() -- compare to numarray

2007-01-05 Thread Russell E Owen
In article <[EMAIL PROTECTED]>, "Sebastian Haase" <[EMAIL PROTECTED]> wrote: >...But maybe even more worry some for the converting from numarray is this: > >>> a = N.array([5]) > >>> 999 # to kill '_' - reference > 999 > >>> a.resize(2) > >>> a > [5 0] > > in numarray you would get > >>> a =

Re: [Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-05 Thread Robert Kern
Sebastian Haase wrote: > Hi! > After I upgraded from numpy 1.0 to 1.0.1 > I get an abort in a C-module: > > RuntimeError: module compiled against version 102 of C-API but this > version of numpy is 109 > Fatal Python error: numpy.core.multiarray failed to import... exiting. > /opt/bin/prii

Re: [Numpy-discussion] discussion about array.resize() -- compare to numarray

2007-01-05 Thread Russell E Owen
In article <[EMAIL PROTECTED]>, "Sebastian Haase" <[EMAIL PROTECTED]> wrote: > On 1/4/07, Sebastian Haase <[EMAIL PROTECTED]> wrote: > > > >>> N.__version__ > > '1.0.2.dev3487' > > > > in any case: inside the script it somehow generated a nan --- is > > there a bug in numpy !? > > No bug her

[Numpy-discussion] recompiling needed for binary module after numpy 1.0

2007-01-05 Thread Sebastian Haase
Hi! After I upgraded from numpy 1.0 to 1.0.1 I get an abort in a C-module: RuntimeError: module compiled against version 102 of C-API but this version of numpy is 109 Fatal Python error: numpy.core.multiarray failed to import... exiting. /opt/bin/priithonN: line 37: 1409 Aborted

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Jeff Whitaker
Matt Knox wrote: > I made a post about this a while ago on the scipy-user mailing list, but I > didn't receive much of a response so I'm just throwing it out there again > (with more detail) in case it got overlooked. > > Basically, I'd like to be able to do accumulate operations with custom > f

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Christopher Barker
Travis Oliphant wrote: > Christopher Barker wrote: >> wxPython -- Robin Dunn >> PIL -- Fredrik Lundh >> PyOpenGL -- Who? >> PyObjC -- would it be useful there? (Ronald Oussoren) >> MatplotLib (but maybe it's already married to numpy...) >> PyGtk ? > It's a good start, but their is also > > P

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Charles R Harris
On 1/5/07, Tim Hochberg <[EMAIL PROTECTED]> wrote: Matt Knox wrote: > I made a post about this a while ago on the scipy-user mailing list, but I didn't receive much of a response so I'm just throwing it out there again (with more detail) in case it got overlooked. > > Basically, I'd like to be a

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Robert Kern
Neal Becker wrote: > I'm thinking that a buffer is just an interface to memory, and that the > interpretation as an array of n-dimensions, for example, is best left to > the application. I might want to at one time view the data as > n-dimensional, but at another time as 1-dimensional, for exampl

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Tim Hochberg
Matt Knox wrote: > I made a post about this a while ago on the scipy-user mailing list, but I > didn't receive much of a response so I'm just throwing it out there again > (with more detail) in case it got overlooked. > > Basically, I'd like to be able to do accumulate operations with custom > f

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Matt Knox
> > On Friday 05 of January 2007 17:42, Matt Knox wrote: > > - > > Example 1 - exponential moving average: > > > > # naive brute force method... > > def expmave(x, k): > > result = numpy.array(x, copy=True) > > for i in range(1, result.size): > >

Re: [Numpy-discussion] custom accumlators

2007-01-05 Thread Karol Langner
On Friday 05 of January 2007 17:42, Matt Knox wrote: > - > Example 1 - exponential moving average: > > # naive brute force method... > def expmave(x, k): > result = numpy.array(x, copy=True) > for i in range(1, result.size): >result[i] = r

[Numpy-discussion] custom accumlators

2007-01-05 Thread Matt Knox
I made a post about this a while ago on the scipy-user mailing list, but I didn't receive much of a response so I'm just throwing it out there again (with more detail) in case it got overlooked. Basically, I'd like to be able to do accumulate operations with custom functions. numpy.vectorize d

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Charles R Harris
On 1/5/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: Charles R Harris wrote: > > > On 1/5/07, *Stefan van der Walt* <[EMAIL PROTECTED] > > wrote: > > On Fri, Jan 05, 2007 at 09:38:49AM -0500, Neal Becker wrote: > > Several extensions to Python utilize the

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Travis Oliphant
Charles R Harris wrote: > > > On 1/5/07, *Stefan van der Walt* <[EMAIL PROTECTED] > > wrote: > > On Fri, Jan 05, 2007 at 09:38:49AM -0500, Neal Becker wrote: > > Several extensions to Python utilize the buffer protocol to > share > > the location

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Travis Oliphant
Neal Becker wrote: >Several extensions to Python utilize the buffer protocol to share >the location of a data-buffer that is really an N-dimensional >array. However, there is no standard way to exchange the >additional N-dimensional array information so that the data-buffer >i

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Charles R Harris
On 1/5/07, Stefan van der Walt <[EMAIL PROTECTED]> wrote: On Fri, Jan 05, 2007 at 09:38:49AM -0500, Neal Becker wrote: > Several extensions to Python utilize the buffer protocol to share > the location of a data-buffer that is really an N-dimensional > array. However, there is no st

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Stefan van der Walt
On Fri, Jan 05, 2007 at 09:38:49AM -0500, Neal Becker wrote: > Several extensions to Python utilize the buffer protocol to share > the location of a data-buffer that is really an N-dimensional > array. However, there is no standard way to exchange the > additional N-dimensional arr

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Neal Becker
Travis Oliphant wrote: > Neal Becker wrote: >> Travis Oliphant wrote: >> >> >>> I'm attaching my latest extended buffer-protocol PEP that is trying to >>> get the array interface into Python. Basically, it is a translation of >>> the numpy header files into something as simple as possible that

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Matthew Brett
Hi, > > wxPython -- Robin Dunn > > PIL -- Fredrik Lundh > > PyOpenGL -- Who? > > PyObjC -- would it be useful there? (Ronald Oussoren) > > MatplotLib (but maybe it's already married to numpy...) > > PyGtk ? > > > > It's a good start, but their is also > > PyMedia, PyVoxel, any video-library i

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Travis Oliphant
Neal Becker wrote: > Travis Oliphant wrote: > > >> I'm attaching my latest extended buffer-protocol PEP that is trying to >> get the array interface into Python. Basically, it is a translation of >> the numpy header files into something as simple as possible that can >> still be used to describ

Re: [Numpy-discussion] subclassing float64 (and friends)

2007-01-05 Thread Travis Oliphant
Stefan van der Walt wrote: > On Wed, Jan 03, 2007 at 05:12:40PM -0600, eric jones wrote: > >> Thanks for the update. For now, I'll try doing what I need to by >> sub-classing float. But, I'm gonna miss __array_finalize__ :-). >> > > Looks like r3493 is intended to fix this. The 'view' m

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Neal Becker
Travis Oliphant wrote: > > I'm attaching my latest extended buffer-protocol PEP that is trying to > get the array interface into Python. Basically, it is a translation of > the numpy header files into something as simple as possible that can > still be used to describe a complicated block of mem

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-05 Thread Francesc Altet
A Divendres 05 Gener 2007 01:36, Travis Oliphant escrigué: > Christopher Barker wrote: > > eople like: > > > > wxPython -- Robin Dunn > > PIL -- Fredrik Lundh > > PyOpenGL -- Who? > > PyObjC -- would it be useful there? (Ronald Oussoren) > > MatplotLib (but maybe it's already married to numpy.

Re: [Numpy-discussion] subclassing float64 (and friends)

2007-01-05 Thread Stefan van der Walt
On Wed, Jan 03, 2007 at 05:12:40PM -0600, eric jones wrote: > Thanks for the update. For now, I'll try doing what I need to by > sub-classing float. But, I'm gonna miss __array_finalize__ :-). Looks like r3493 is intended to fix this. The 'view' method works now, but I still see In [2]: impor

[Numpy-discussion] 1.0.1 release notes missing?

2007-01-05 Thread Sven Schreiber
I found the release notes on the way to 1.0 very useful. However, they stop at 1.0, and I also didn't find any in the 1.0.1 source distribution. Do they exist somewhere? Or are there really only bugfixes in 1.0.1? That information would be useful, too. Thank you, Sven

Re: [Numpy-discussion] ndarray newbie question

2007-01-05 Thread Robert Kern
Pierre GM wrote: > I agree that this one is not really informative. A a.__class__.__doc__? > provides a docstring interestingly truncated under ipython, but nothing > useful either. "a.__class__?" is the command that you are after, not "a.__class__.__doc__?". a.__class__.__doc__ is a strin

Re: [Numpy-discussion] ndarray newbie question

2007-01-05 Thread Fernando Perez
On 1/5/07, Pierre GM <[EMAIL PROTECTED]> wrote: > belinda thom wrote: > > > Some context: the type of introspection I'm often wishing I could do > > > in a single, easy command usually has to do w/getting to know the > > > software better. > > For generic introspection in Python, dir and .__doc__ a

Re: [Numpy-discussion] ndarray newbie question

2007-01-05 Thread Pierre GM
belinda thom wrote: >  > Some context: the type of introspection I'm often wishing I could do >  > in a single, easy command usually has to do w/getting to know the >  > software better. For generic introspection in Python, dir and .__doc__ are very useful. The ? trick works in ipython and prints

Re: [Numpy-discussion] returning recarray records as plain arrays

2007-01-05 Thread Stefan van der Walt
On Thu, Jan 04, 2007 at 01:40:54AM -0500, Pierre GM wrote: > On Wednesday 03 January 2007 23:57, Matthew Koichi Grimes wrote: > > Pierre GM wrote: > > > On Wednesday 03 January 2007 15:39, Matthew Koichi Grimes wrote: > > >> As per Stefan's help, I've made a subclass of recarray called nnvalue. > >

Re: [Numpy-discussion] ndarray newbie question

2007-01-05 Thread Robert Kern
belinda thom wrote: > Pierre, > > Thanks for the reply. > > > Some context: the type of introspection I'm often wishing I could do > > in a single, easy command usually has to do w/getting to know the > > software better. > > dir? > obj.__doc__ ? > > When I try the latter recommendation abov

[Numpy-discussion] ndarray newbie question

2007-01-05 Thread belinda thom
Pierre, Thanks for the reply. > Some context: the type of introspection I'm often wishing I could do > in a single, easy command usually has to do w/getting to know the > software better. dir? obj.__doc__ ? When I try the latter recommendation above w/numpy arrays, I get: In [1]: import num