[Numpy-discussion] C-API for non-contiguous arrays

2007-10-25 Thread Oliver Kranz
Hi, I am working on a Python extension module using of the NumPy C-API. The extension module is an interface to an image processing and analysis library written in C++. The C++ functions are exported with boos::python. Currently I am implementing the support of three-dimensional data sets

[Numpy-discussion] how to select indices from boolean array

2007-10-25 Thread Bernhard Voigt
Dear list, is nonzero the appropriate function to get the indexes of a boolean array? foo = numpy.random.random(1) cut = foo .5 indexes = cut.nonzero()[0] Another question: Why is the the type returned by nonzero a tuple and not an ndarray of the same shape as the input (or self if used on

Re: [Numpy-discussion] C-API for non-contiguous arrays

2007-10-25 Thread Oliver Kranz
Timothy Hochberg wrote: On 10/25/07, *Oliver Kranz* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, I am working on a Python extension module using of the NumPy C-API. The extension module is an interface to an image processing and analysis library written in

[Numpy-discussion] convolution and wiener khinchin

2007-10-25 Thread John Hunter
I am working on an example to illustrate convolution in the temporal and spectral domains, using the property that a convolution in the time domain is a multiplication in the fourier domain. I am using numpy.fft and numpy.convolve to compute the solution two ways, and comparing them. I am

Re: [Numpy-discussion] convolution and wiener khinchin

2007-10-25 Thread Stefan van der Walt
Hi John The signals should be zero-padded, otherwise you get circular convolution: F = npy.fft.fft(r,len(r)+len(x)-1) X = npy.fft.fft(x,len(r)+len(x)-1) Y = F*X yi = npy.fft.ifft(Y)[:len(x)].real Also take a look at fftconv. Regards Stéfan On Thu, Oct 25, 2007 at 01:00:29PM -0500, John Hunter

[Numpy-discussion] fortran array storage question

2007-10-25 Thread Georg Holzmann
Hallo! I have the following problem: I get a data array in column major storage order and want to use it as numpy array without copying data. Therefore I do the following (2D example): obj = PyArray_FromDimsAndData(2, dim0, PyArray_DOUBLE, (char*)data); PyArrayObject *tmp =

[Numpy-discussion] vectorizing loops

2007-10-25 Thread Mathew Yeates
Anybody know of any tricks for handling something like z[0]=1.0 for i in range(100): out[i]=func1(z[i]) z[i+1]=func2(out[i]) ?? ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] C-API for non-contiguous arrays

2007-10-25 Thread David Cournapeau
Oliver Kranz wrote: Hi, I am working on a Python extension module using of the NumPy C-API. The extension module is an interface to an image processing and analysis library written in C++. The C++ functions are exported with boos::python. Currently I am implementing the support of