Re: [Numpy-discussion] Cython/NumPy syntax

2008-08-06 Thread Stéfan van der Walt
2008/8/6 Dag Sverre Seljebotn [EMAIL PROTECTED]: cdef numpy.ndarray[numpy.int64, ndim=2] I'd definitely prefer a comma between the two, and an (optional) ndim keyword argument if possible. I'm taking this as a vote in favor of this and against 2D and ? The keyword is already present in

Re: [Numpy-discussion] Bilateral filter

2008-08-06 Thread Nadav Horesh
I made the following modification to the source code, I hope it is ready to be included in scipy. 1. Added a BSD licence declaration. 2. Small optimisation. 3. The code is split into a cython back-end and a python front-end. All remarks are welcome, Nadav. On Tue,

Re: [Numpy-discussion] Horizontal lines in diffraction image (NumPy FFT)

2008-08-06 Thread Nadav Horesh
I did about the same thing 9 year ago (in python of course). If I can recall correctly, you need to double the arrays size (with padding of 0) in order to avoid this artifact. I think that its origin is that the DFT is equivalent to periodic boundary conditions. Nadav. -הודעה

[Numpy-discussion] win32 1.1.1 testsuite issue with python -O

2008-08-06 Thread Jon Wright
Hello, If I use the -O switch then it seems getting some testcase failures, and finally a windows message that python.exe has encountered a problem and needs to close. We are sorry for the inconvenience.. Running the testsuite via jepp (jepp.sourceforge.net) gives the same failures, plus 8

[Numpy-discussion] Numpy random: independent streams

2008-08-06 Thread Ludwig
The Python standard random API allows me to define multiple independent random streams, which I can control with their own seed, e.g. import random generator_1 = random.Random() generator_2 = random.Random() generator_1.seed(100) generator_2.seed(100) So now generator_1 and 2 will produce the

Re: [Numpy-discussion] Numpy random: independent streams

2008-08-06 Thread Robert Kern
On Wed, Aug 6, 2008 at 04:30, Ludwig [EMAIL PROTECTED] wrote: The Python standard random API allows me to define multiple independent random streams, which I can control with their own seed, e.g. import random generator_1 = random.Random() generator_2 = random.Random()

Re: [Numpy-discussion] Horizontal lines in diffraction image (NumPy FFT)

2008-08-06 Thread Matthieu Brucher
Exactly. Using FFT to do a convolution should be done after some signal processing readings ;) (That's why I hate FFT to do signal processing as well). Matthieu 2008/8/6 Nadav Horesh [EMAIL PROTECTED]: I did about the same thing 9 year ago (in python of course). If I can recall correctly,

[Numpy-discussion] confusion on importing numpy

2008-08-06 Thread mark
Hello list. I am confused about importing numpy. When I do from numpy import * and I try the min function, I get the default Python min function. On the other hand, when I do import numpy as np and use the np.min function, I get the numpy min function (which is obviously what I want). I

Re: [Numpy-discussion] confusion on importing numpy

2008-08-06 Thread Robert Kern
On Wed, Aug 6, 2008 at 05:00, mark [EMAIL PROTECTED] wrote: Hello list. I am confused about importing numpy. When I do from numpy import * and I try the min function, I get the default Python min function. On the other hand, when I do import numpy as np and use the np.min function, I

Re: [Numpy-discussion] Horizontal lines in diffraction image (NumPy FFT)

2008-08-06 Thread Stéfan van der Walt
2008/8/6 Matthieu Brucher [EMAIL PROTECTED]: Exactly. Using FFT to do a convolution should be done after some signal processing readings ;) When you convolve two signals, of lengths N and M, you need to pad the FFTs to length (N+M-1) before multiplication. You can take a look at my linear

Re: [Numpy-discussion] confusion on importing numpy

2008-08-06 Thread mark
I guess that makes sense on a certain level, but boy it is cumbersome to explain to a class. It pretty much defeats the whole purpose of doing from numpy import *. Mark On Aug 6, 12:03 pm, Robert Kern [EMAIL PROTECTED] wrote: On Wed, Aug 6, 2008 at 05:00, mark [EMAIL PROTECTED] wrote: Hello

Re: [Numpy-discussion] confusion on importing numpy

2008-08-06 Thread Bill Baxter
Anything that defeats the purpose of doing * imports is good in my book. :-) Seriously, willy nilly import of any package into the base namespace is just asking for trouble. Tell your class to import numpy as np, then there will be no chance of confusion. Then later tell them about from numpy

Re: [Numpy-discussion] member1d and unique elements

2008-08-06 Thread Robert Cimrman
Hi Greg, Greg Novak wrote: Argh. I could swear that yesterday I typed test cases just like the one you provide, and it behaved correctly. Nevertheless, it clearly fails in spite of my memory, so attached is a version which I believe gives the correct behavior. It looks ok now, although I

[Numpy-discussion] unique1d returning indices

2008-08-06 Thread Robert Cimrman
Hi, due to popular demand, I have updated unique1d() to optionally return both kinds of indices: In [3]: b, i, j = nm.unique1d( a, return_index=True, return_inverse=True ) In [4]: a Out[4]: array([1, 1, 8, 3, 3, 5, 4]) In [6]: b Out[6]: array([1, 3, 4, 5, 8]) In [7]: a[i] Out[7]: array([1,

[Numpy-discussion] Slicing without a priori knowledge of dimension

2008-08-06 Thread Matthew Czesarski
Dear list. I've got a feeling that what I'm trying to do *should* be easy but at the moment I can't find a non-brute-force method. I'm working with quite a high-rank matrix; 7 dimensions filled with chi**2 values. It's form is something like this: chi2 = numpy.ones((3,4,5,6,7,8,9)) What I

Re: [Numpy-discussion] Slicing without a priori knowledge of dimension

2008-08-06 Thread Hoyt Koepke
Try using slice (python builtin) to create slice objects (what is created implicitly by :5, 1:20, etc.). slice takes the same arguments as range. A list of these (7 in your case) can then be passed to A[...] as a tuple. That's how I would do it, but maybe someone else has a better idea or can

Re: [Numpy-discussion] cubic spline function in numarray or numpy

2008-08-06 Thread Nadav Horesh
You can access nd_image by: from numpy.numarray import nd_image but as Zach noted, scipy.interpolate is what you are looking for. Nadav. -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם Zachary Pincus נשלח: ד 06-אוגוסט-08 19:09 אל: Discussion of Numerical Python נושא: Re: [Numpy-discussion]

[Numpy-discussion] cubic spline function in numarray or numpy

2008-08-06 Thread Gong, Shawn (Contractor)
hi list, I am trying to find 1-D cubic spline function. Google search yields that there is a function called spline_filter1d in numarray. But I am not able to call it. Would someone point me to 1-D cubic spline function either in numarray or numpy? I can find source codes and enter in Python.

Re: [Numpy-discussion] cubic spline function in numarray or numpy

2008-08-06 Thread James Turner
Hi Shawn, I am trying to find 1-D cubic spline function. But I am not able to call it. Error message can’t find “ndimage” Ndimage is a module in SciPy, so you'd need to install that first, not just NumPy. I'm not really familar with the available 1-D cubic spline functions, but I think you

Re: [Numpy-discussion] cubic spline function in numarray or numpy

2008-08-06 Thread Gong, Shawn (Contractor)
Thank you both, Nadav and Zach. Shawn -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nadav Horesh Sent: Wednesday, August 06, 2008 12:16 PM To: Discussion of Numerical Python Subject: RE: [Numpy-discussion] cubic spline function in numarray or numpy

Re: [Numpy-discussion] Cython/NumPy syntax

2008-08-06 Thread Christopher Barker
Dag Sverre Seljebotn wrote: cdef numpy.ndarray[numpy.int64, ndim=2] +1 it's very clear what this means. I think the keyword should be required. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE

Re: [Numpy-discussion] confusion on importing numpy

2008-08-06 Thread Christopher Barker
mark wrote: I guess that makes sense on a certain level, but boy it is cumbersome to explain to a class. It pretty much defeats the whole purpose of doing from numpy import *. which is fine by me: Namespaces are one honking great idea -- let's do more of those! explain namespaces to your

Re: [Numpy-discussion] cubic spline function in numarray or numpy

2008-08-06 Thread Gary Ruben
You're best off using scipy. Just Google search for scipy spline: e.g. http://www.scipy.org/Cookbook/Interpolation http://xinqingpeng.blogspot.com/2007/07/scipy-spline-example.html Gary R. Gong, Shawn (Contractor) wrote: hi list, I am trying to find 1-D cubic spline function. But I am not

Re: [Numpy-discussion] Cython/NumPy syntax

2008-08-06 Thread Tom Denniston
I think the square brackets are very confusing as a numpy user not familiar with CPython. On 8/6/08, Christopher Barker [EMAIL PROTECTED] wrote: Dag Sverre Seljebotn wrote: cdef numpy.ndarray[numpy.int64, ndim=2] +1 it's very clear what this means. I think the keyword should be required.

Re: [Numpy-discussion] Calculating roots with negative numbers

2008-08-06 Thread Matthias Hillenbrand
Hello, When you convolve two signals, of lengths N and M, you need to pad the FFTs to length (N+M-1) before multiplication. You can take a look at my linear position-invariant filtering code at: http://mentat.za.net/hg/filter I understand your comments that I need zero padding when doing

[Numpy-discussion] What happened to numpy.testing.Tester ?

2008-08-06 Thread Robert Pyle
Hi all, My machine: Mac dual G5, OSX 10.5.4, Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53), numpy 1.1.1 After considerable agony, I succeeded in building and installing scipy from SVN, only to be told upon importing it: Traceback (most recent call last): File stdin, line 1, in module

Re: [Numpy-discussion] What happened to numpy.testing.Tester ?

2008-08-06 Thread Alan McIntyre
On Wed, Aug 6, 2008 at 3:57 PM, Robert Pyle [EMAIL PROTECTED] wrote: My machine: Mac dual G5, OSX 10.5.4, Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53), numpy 1.1.1 After considerable agony, I succeeded in building and installing scipy from SVN, only to be told upon importing it:

Re: [Numpy-discussion] What happened to numpy.testing.Tester ?

2008-08-06 Thread Robert Pyle
On Aug 6, 2008, at 4:17 PM, Alan McIntyre wrote: You will actually need to use NumPy from svn as well, since 1.1.1 didn't have NoseTester (SciPy 0.7 will require NumPy 1.2). Thanks. I can now import scipy, but I'm puzzled by the following: Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)

Re: [Numpy-discussion] confusion on importing numpy

2008-08-06 Thread mark
Thanks for the encouragement to try to dive deeper into namespaces, but also thanks for the amin, amax suggestions. Mark On Aug 6, 8:21 pm, Eric Firing [EMAIL PROTECTED] wrote: mark wrote: Hello list. I am confused about importing numpy. When I do from numpy import * and I try the min

Re: [Numpy-discussion] What happened to numpy.testing.Tester ?

2008-08-06 Thread robert . kern
Tester is a class, not a module. Try from numpy.testing import Tester. On 2008-08-06, Robert Pyle [EMAIL PROTECTED] wrote: On Aug 6, 2008, at 4:17 PM, Alan McIntyre wrote: You will actually need to use NumPy from svn as well, since 1.1.1 didn't have NoseTester (SciPy 0.7 will require NumPy

Re: [Numpy-discussion] confusion on importing numpy

2008-08-06 Thread Anne Archibald
2008/8/6 Eric Firing [EMAIL PROTECTED]: While I agree with the other posters that import * is not preferred, if you want to use it, the solution is to use amin and amax, which are provided precisely to avoid the conflict. Just as arange is a numpy analog of range, amin and amax are numpy

Re: [Numpy-discussion] Horizontal lines in diffraction image (NumPy FFT)

2008-08-06 Thread Matthias Hillenbrand
Hello, When you convolve two signals, of lengths N and M, you need to pad the FFTs to length (N+M-1) before multiplication. You can take a look at my linear position-invariant filtering code at: http://mentat.za.net/hg/filter I understand your comments that I need zero padding when doing

Re: [Numpy-discussion] Horizontal lines in diffraction image (NumPyFFT)

2008-08-06 Thread Nadav Horesh
The 0 padding is easy in numpp/pylab as in octave/matlab, by just adding one argument. In pylab it is the a keyword: y = fft(x, n=2*len(x)) if n is not given then n=len(x) --- normal fft if n len(x) then it pads x with 0. Nadav. -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם Matthias