[Numpy-discussion] Re FFTs in SciPy (and NumPy)

2010-07-12 Thread Sturla Molden
There has been some discussion on FFTPACK lately. Problems with FFTPACK seems to be: - Written in old Fortran 77. - Unprecise for single precision. - Can sometimes be very slow, depending on input size. - Can only handle a few small prime factors {2,3,4,5} efficiently. - How to control integer si

Re: [Numpy-discussion] Here's what I've done to numpy.fft

2010-07-12 Thread David Goldsmith
2010/7/12 Jochen Schröder > On 13/07/10 08:47, David Goldsmith wrote: > > In light of my various questions and the responses thereto, here's what > > I've done (but not yet committed) to numpy.fft. > > > > There are many ways to define the DFT, varying in the sign of the > > exponent, normalizati

Re: [Numpy-discussion] numpy.fft, yet again

2010-07-12 Thread David Goldsmith
2010/7/12 Jochen Schröder > On 13/07/10 08:04, Eric Firing wrote: > > On 07/12/2010 11:43 AM, David Goldsmith wrote: > >> > From the docstring: > >> > >> "A[0] contains the zero-frequency term (the mean of the signal)" > >> > >> And yet, consistent w/ the definition given in the docstring (and

Re: [Numpy-discussion] match or vectorized in-type function.

2010-07-12 Thread Zachary Pincus
> match(v1, v2) => returns a boolean array of length len(v1) indicating > whether element i in v1 is in v2. You want numpy.in1d (and friends, probably, like numpy.unique and the others that are all collected in numpy.lib.arraysetops...) Definition: numpy.in1d(ar1, ar2, assume_unique=Fals

[Numpy-discussion] match or vectorized in-type function.

2010-07-12 Thread James Bullard
I have two vectors of integers of not necessarily the same length. Consider the hypothetical function match (or if you are familiar to R then consider that function). match(v1, v2) => returns a boolean array of length len(v1) indicating whether element i in v1 is in v2. I cannot find this funct

Re: [Numpy-discussion] Here's what I've done to numpy.fft

2010-07-12 Thread Jochen Schröder
On 13/07/10 08:47, David Goldsmith wrote: > In light of my various questions and the responses thereto, here's what > I've done (but not yet committed) to numpy.fft. > > There are many ways to define the DFT, varying in the sign of the > exponent, normalization, etc. In this implementation, the DF

Re: [Numpy-discussion] Here's what I've done to numpy.fft

2010-07-12 Thread David Goldsmith
On Mon, Jul 12, 2010 at 6:33 PM, Travis Oliphant wrote: > > On Jul 12, 2010, at 5:47 PM, David Goldsmith wrote: > > > In light of my various questions and the responses thereto, here's what > I've done (but not yet committed) to numpy.fft. > > > > There are many ways to define the DFT, varying in

Re: [Numpy-discussion] numpy.fft, yet again

2010-07-12 Thread Jochen Schröder
On 13/07/10 08:04, Eric Firing wrote: > On 07/12/2010 11:43 AM, David Goldsmith wrote: >> > From the docstring: >> >> "A[0] contains the zero-frequency term (the mean of the signal)" >> >> And yet, consistent w/ the definition given in the docstring (and >> included w/ an earlier email), the code

Re: [Numpy-discussion] Here's what I've done to numpy.fft

2010-07-12 Thread Travis Oliphant
On Jul 12, 2010, at 5:47 PM, David Goldsmith wrote: > In light of my various questions and the responses thereto, here's what I've > done (but not yet committed) to numpy.fft. > > There are many ways to define the DFT, varying in the sign of the > exponent, normalization, etc. In this impleme

Re: [Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes

2010-07-12 Thread Robert Kern
On Mon, Jul 12, 2010 at 17:30, Rob Speer wrote: > rec['305'] extracts a single value from a single record. No, in Neil's example `rec` was a structured array. You can index structured arrays using the names of the record members, not just scalars. > arr.named[:,305] extracts an *entire column* f

[Numpy-discussion] Here's what I've done to numpy.fft

2010-07-12 Thread David Goldsmith
In light of my various questions and the responses thereto, here's what I've done (but not yet committed) to numpy.fft. There are many ways to define the DFT, varying in the sign of the exponent, normalization, etc. In this implementation, the DFT is defined as .. math:: A_k = \sum_{m=0}^{n-

Re: [Numpy-discussion] Memory leak found in ndarray (I think)?

2010-07-12 Thread Nathaniel Peterson
Wes McKinney writes: > Did you mean to post a different link? That's the ticket I just created :) How silly of me! I meant http://projects.scipy.org/numpy/ticket/1427 ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/ma

Re: [Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes

2010-07-12 Thread Rob Speer
rec['305'] extracts a single value from a single record. arr.named[:,305] extracts an *entire column* from a 2-D datarray, returning you a 1-D datarray. Once again, 1-D record arrays and 2-D labeled arrays look similar when you print them, but the data structures are so unrelated that there is rea

Re: [Numpy-discussion] numpy.fft, yet again

2010-07-12 Thread David Goldsmith
On Mon, Jul 12, 2010 at 3:04 PM, Eric Firing wrote: > On 07/12/2010 11:43 AM, David Goldsmith wrote: > > >From the docstring: > > > > "A[0] contains the zero-frequency term (the mean of the signal)" > > > > And yet, consistent w/ the definition given in the docstring (and > > included w/ an earl

Re: [Numpy-discussion] numpy.fft, yet again

2010-07-12 Thread Eric Firing
On 07/12/2010 11:43 AM, David Goldsmith wrote: > >From the docstring: > > "A[0] contains the zero-frequency term (the mean of the signal)" > > And yet, consistent w/ the definition given in the docstring (and > included w/ an earlier email), the code gives, e.g.: > > >>> import numpy as np > >>>

Re: [Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes

2010-07-12 Thread Neil Crighton
Rob Speer MIT.EDU> writes: > It's not just about the rows: a 2-D datarray can also index by > columns, an operation that has no equivalent in a 1-D array of records > like your example. rec['305'] effectively indexes by column. This is one the main attractions of structured/record arrays. _

[Numpy-discussion] numpy.fft, yet again

2010-07-12 Thread David Goldsmith
>From the docstring: "A[0] contains the zero-frequency term (the mean of the signal)" And yet, consistent w/ the definition given in the docstring (and included w/ an earlier email), the code gives, e.g.: >>> import numpy as np >>> x = np.ones((16,)); x array([ 1., 1., 1., 1., 1., 1., 1.,

Re: [Numpy-discussion] Memory leak found in ndarray (I think)?

2010-07-12 Thread Wes McKinney
On Mon, Jul 12, 2010 at 3:39 PM, Nathaniel Peterson wrote: > This memory leak may be related: http://projects.scipy.org/numpy/ticket/1542 > It shows what appears to be a memory leak when calling astype('float') > on an array of dtype 'object'. > ___ > Nu

Re: [Numpy-discussion] Memory leak found in ndarray (I think)?

2010-07-12 Thread Nathaniel Peterson
This memory leak may be related: http://projects.scipy.org/numpy/ticket/1542 It shows what appears to be a memory leak when calling astype('float') on an array of dtype 'object'. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.sci

Re: [Numpy-discussion] Memory leak found in ndarray (I think)?

2010-07-12 Thread Wes McKinney
On Mon, Jul 12, 2010 at 2:22 PM, Wes McKinney wrote: > This one was quite a bear to track down, starting from the of course > very high level observation of "why is my application leaking memory". > I've reproduced it on Windows XP using NumPy 1.3.0 on Python 2.5 and > 1.4.1 on Python 2.6 (EPD). B

Re: [Numpy-discussion] 3 dim array unpacking

2010-07-12 Thread Anne Archibald
On 12 July 2010 13:24, K.-Michael Aye wrote: > Dear numpy hackers, > > I can't find the syntax for unpacking the 3 dimensions of a rgb array. > so i have a MxNx3 image array 'img' and would like to do: > > red, green, blue = img[magical_slicing] > > Which slicing magic do I need to apply? Not sli

[Numpy-discussion] 3 dim array unpacking

2010-07-12 Thread K . -Michael Aye
Dear numpy hackers, I can't find the syntax for unpacking the 3 dimensions of a rgb array. so i have a MxNx3 image array 'img' and would like to do: red, green, blue = img[magical_slicing] Which slicing magic do I need to apply? Thanks for your help! BR, Michael _

[Numpy-discussion] Memory leak found in ndarray (I think)?

2010-07-12 Thread Wes McKinney
This one was quite a bear to track down, starting from the of course very high level observation of "why is my application leaking memory". I've reproduced it on Windows XP using NumPy 1.3.0 on Python 2.5 and 1.4.1 on Python 2.6 (EPD). Basically it seems that calling .astype(bool) on an ndarray sli

Re: [Numpy-discussion] BOF notes: Fernando's proposal: NumPy ndarray with named axes

2010-07-12 Thread Rob Speer
It's not just about the rows: a 2-D datarray can also index by columns, an operation that has no equivalent in a 1-D array of records like your example. In the movie example, arr.col_named(305) (or, in datarray syntax, arr.named[:,305], or arr.user.named[305]) contains the movie ratings for the us

Re: [Numpy-discussion] Another reality check

2010-07-12 Thread David Goldsmith
Thanks, both. On Mon, Jul 12, 2010 at 5:39 AM, Fabrice Silva wrote: > Le lundi 12 juillet 2010 à 18:14 +1000, Jochen Schröder a écrit : > > On 07/12/2010 12:36 PM, David Goldsmith wrote: > > > On Sun, Jul 11, 2010 at 6:18 PM, David Goldsmith > > > mailto:d.l.goldsm...@gmail.com>> wrote: > > > > >

Re: [Numpy-discussion] BOF notes: Fernando's?proposal:?NumPy?ndarray with named axes

2010-07-12 Thread Gael Varoquaux
On Mon, Jul 12, 2010 at 01:04:55PM +, Neil Crighton wrote: > Thanks, that's a really nice description. Instead of > data.ax_day.mean(axis=0) > I think it would be clearer to do something like > data.mean(axis='day') Yes, that's even better. The problem is that it does not extend to operati

Re: [Numpy-discussion] BOF notes: Fernando's proposal: NumPy?ndarray with named axes

2010-07-12 Thread Ryan May
On Mon, Jul 12, 2010 at 8:04 AM, Neil Crighton wrote: > Gael Varoquaux normalesup.org> writes: >> I do such manipulation all the time, and keeping track of which axis is >> what is fairly tedious and error prone. It would be much nicer to be able >> to write: >> >>     data.ax_day.mean(axis=0) >>

Re: [Numpy-discussion] Another reality check

2010-07-12 Thread Fabrice Silva
Le lundi 12 juillet 2010 à 18:14 +1000, Jochen Schröder a écrit : > On 07/12/2010 12:36 PM, David Goldsmith wrote: > > On Sun, Jul 11, 2010 at 6:18 PM, David Goldsmith > > mailto:d.l.goldsm...@gmail.com>> wrote: > > > > In numpy.fft we find the following: > > > > "Then A[1:n/2] contains the

Re: [Numpy-discussion] BOF notes: Fernando's proposal : NumPy?ndarray with named axes

2010-07-12 Thread Neil Crighton
Gael Varoquaux normalesup.org> writes: > Let say that you have a dataset that is in a 3D array, where axis 0 > corresponds to days, axis 1 to hours of the day, and axis 2 to > temperature, you might want to have the mean of the temperature in each > day, which would be in current numpy: > >

Re: [Numpy-discussion] Function returns nothing!

2010-07-12 Thread Scott Sinclair
>On 12 July 2010 11:45, allan oware wrote: > Hi All! > > def height_diffs(): >     h = [] >     i = 0 >     while True: >     x = raw_input("Enter height difference ") >     if x == 'q': >     break >     else: >     h.append(x) >     i = i + 1 > >     m = asarr

Re: [Numpy-discussion] BOF notes: Fernando's proposal: NumPy?ndarray with named axes

2010-07-12 Thread Gael Varoquaux
On Sun, Jul 11, 2010 at 11:59:30AM +, Neil Crighton wrote: > What is a use case for the new array type that can't be solved by > structured/record arrays? Sounds like it was decided at the Sciy > BOF they were a good idea, several people have implemented a > version of them and Fernando and Ga

[Numpy-discussion] Function returns nothing!

2010-07-12 Thread allan oware
Hi All! def height_diffs(): h = [] i = 0 while True: x = raw_input("Enter height difference ") if x == 'q': break else: h.append(x) i = i + 1 m = asarray(h,dtype=float) return m why does return statement return not

Re: [Numpy-discussion] Another reality check

2010-07-12 Thread Jochen Schröder
On 07/12/2010 12:36 PM, David Goldsmith wrote: > On Sun, Jul 11, 2010 at 6:18 PM, David Goldsmith > mailto:d.l.goldsm...@gmail.com>> wrote: > > In numpy.fft we find the following: > > "Then A[1:n/2] contains the positive-frequency terms, and A[n/2+1:] > contains the negative-frequency t