Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Sturla Molden
On 1/27/2009 6:03 AM, Jochen wrote: BTW memmap arrays have the same problem if I create a memmap array and later do something like a=a+1 all later changes will not be written to the file. = is Python's rebinding operator. a = a + 1 rebinds a to a different object. As for ndarray's, I'd

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Sturla Molden
On 1/27/2009 1:26 AM, Jochen wrote: a = fftw3.AlignedArray(1024,complex) a = a+1 = used this way is not assignment, it is name binding. It is easy to use function's like fftw_malloc with NumPy: import ctypes import numpy fftw_malloc = ctypes.cdll.fftw.fftw_malloc fftw_malloc.argtypes =

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Sturla Molden
On 1/27/2009 12:37 PM, Sturla Molden wrote: address = fftw_malloc(N * d.nbytes) # restype = ctypes.c_ulong if (address = 0): if (address == ): raise MemoryError, 'fftw_malloc returned NULL' Sorry for the typo. S.M. ___

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Sturla Molden
On 1/27/2009 12:37 PM, Sturla Molden wrote: It is easy to use function's like fftw_malloc with NumPy: Besides this, if I were to write a wrapper for FFTW in Python, I would consider wrapping FFTW's Fortran interface with f2py. It is probably safer, as well as faster, than using ctypes. It

[Numpy-discussion] Slicing and structured arrays question

2009-01-27 Thread Hanno Klemm
Hi, I have the following question, that I could not find an answer to in the example list, or by googling: I have a record array with dtype such as: dtype([('times', 'f8'), ('sensors', '|S8'), ('prop1', 'f8'), ('prop2', 'f8'), ('prop3', 'f8'), ('prop4', 'f8')]) I would now like to calculate

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Sturla Molden
On 1/27/2009 12:37 PM, Sturla Molden wrote: import ctypes import numpy fftw_malloc = ctypes.cdll.fftw.fftw_malloc fftw_malloc.argtypes = [ctypes.c_ulong,] fftw_malloc.restype = ctypes.c_ulong def aligned_array(N, dtype): d = dtype() address = fftw_malloc(N * d.nbytes) #

[Numpy-discussion] PyArray_Zeros

2009-01-27 Thread Hanni Ali
Hi, I have been having trouble with the PyArray_Zeros/PyArray_ZEROS functions. I cannot seem to create an array using these functions. resultArray = PyArray_ZEROS(otherArray-nd, otherArray-dimensions, NPY_DOUBLE, 0); I would have thought this would have created an array the same shape as the

Re: [Numpy-discussion] Slicing and structured arrays question

2009-01-27 Thread Travis Oliphant
Hanno Klemm wrote: Hi, I have the following question, that I could not find an answer to in the example list, or by googling: I have a record array with dtype such as: dtype([('times', 'f8'), ('sensors', '|S8'), ('prop1', 'f8'), ('prop2', 'f8'), ('prop3', 'f8'), ('prop4', 'f8')]) I would

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Jochen
On Tue, 2009-01-27 at 12:37 +0100, Sturla Molden wrote: On 1/27/2009 1:26 AM, Jochen wrote: a = fftw3.AlignedArray(1024,complex) a = a+1 = used this way is not assignment, it is name binding. It is easy to use function's like fftw_malloc with NumPy: import ctypes import numpy

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Jochen
On Tue, 2009-01-27 at 14:16 +0100, Sturla Molden wrote: On 1/27/2009 12:37 PM, Sturla Molden wrote: import ctypes import numpy fftw_malloc = ctypes.cdll.fftw.fftw_malloc fftw_malloc.argtypes = [ctypes.c_ulong,] fftw_malloc.restype = ctypes.c_ulong def aligned_array(N, dtype):

[Numpy-discussion] recfunctions.stack_arrays

2009-01-27 Thread Ryan May
Pierre (or anyone else who cares to chime in), I'm using stack_arrays to combine data from two different files into a single array. In one of these files, the data from one entire record comes back missing, which, thanks to your recent change, ends up having a boolean dtype. There is actual data

Re: [Numpy-discussion] recfunctions.stack_arrays

2009-01-27 Thread Pierre GM
[Some background: we're talking about numpy.lib.recfunctions, a set of functions to manipulate structured arrays] Ryan, If the two files have the same structure, you can use that fact and specify the dtype of the output directly with the dtype parameter of mafromtxt. That way, you're sure

[Numpy-discussion] make latex in numpy/doc failed

2009-01-27 Thread Nils Wagner
Hi all, a make latex in numpy/doc failed with ... Intersphinx hit: PyObject http://docs.python.org/dev/c-api/structures.html writing... Sphinx error: too many nesting section levels for LaTeX, at heading: numpy.ma.MaskedArray.__lt__ make: *** [latex] Fehler 1 I am using sphinxv0.5.1 BTW,

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Sturla Molden
On Tue, 2009-01-27 at 14:16 +0100, Sturla Molden wrote: def aligned_array(N, dtype): d = dtype() tmp = numpy.array(N * d.nbytes + 16, dtype=numpy.uint8) address = tmp.__array_interface__['data'][0] offset = (16 - address % 16) % 16 return

Re: [Numpy-discussion] recfunctions.stack_arrays

2009-01-27 Thread Pierre GM
On Jan 27, 2009, at 4:23 PM, Ryan May wrote: I definitely wouldn't advocate magic by default, but I think it would be nice to be able to get the functionality if one wanted to. OK. Put on the TODO list. There is one problem I noticed, however. I found common_type and lib.mintypecode,

[Numpy-discussion] Building on WinXP 64-bit, Intel Compilers

2009-01-27 Thread Michael Colonno
Hi ~ I'm trying to build numpy (hopefully eventually scipy with the same setup) with the Intel compilers (and Intel MKL) on the WinXP 64-bit platform. Finding / linking to the Intel MKL seems to be successful (see below) but I have an issue with the settings defined somewhere in the various

Re: [Numpy-discussion] Building on WinXP 64-bit, Intel Compilers

2009-01-27 Thread Michael Colonno
Thanks for your response. I manually edited one of the python files (ccompiler.py I think) to change icc.exe to icl.exe. (This is a trick I used to use to get F2PY to compile on Windows platforms.) Since icl is a drop-in replacement for the visual studio compiler / linker, I'd like to edit the