Re: [Numpy-discussion] np.isfinite on structured arrays

2009-07-15 Thread Pauli Virtanen
Tue, 14 Jul 2009 14:45:11 -0400, Pierre GM kirjoitti: Consider the following code: a = np.array(zip(np.arange(3)),dtype=[('a',float)]) np.isfinite(a) NotImplemented That is, when the input is a structured array, np.isfinite returns an object of type NotImplementedType. I would have

Re: [Numpy-discussion] mean of two or more arrays while ignoring a specific value

2009-07-15 Thread Zachary Pincus
Might want to look into masked arrays: numpy.ma.array. a = numpy.array([1,5,4,99]) b = numpy.array([3,7,2,8]) arr = numpy.array([a, b]) masked = numpy.ma.array(arr, mask = arr==99) masked.mean(axis=0) masked_array(data = [2.0 6.0 3.0 8.0], mask = [False False False False],

[Numpy-discussion] saving complex vector

2009-07-15 Thread Neal Becker
Simple question. I want to save a complex vector as text in format real_0 imag_0\n real_1 imag_1\n ... I thought to use something like: np.savetxt ('gen_qpsk.txt', (mod_out.real, mod_out.imag), fmt='%g %g\n') I need a way to reinterpret the complex data as an array with 2 columns to make this

Re: [Numpy-discussion] saving complex vector

2009-07-15 Thread Dave
Neal Becker ndbecker2 at gmail.com writes: Simple question. I want to save a complex vector as text in format real_0 imag_0\n real_1 imag_1\n ... I thought to use something like: np.savetxt ('gen_qpsk.txt', (mod_out.real, mod_out.imag), fmt='%g %g\n') I need a way to reinterpret

Re: [Numpy-discussion] np.isfinite on structured arrays

2009-07-15 Thread Pierre GM
On Jul 15, 2009, at 4:23 AM, Pauli Virtanen wrote: Tue, 14 Jul 2009 14:45:11 -0400, Pierre GM kirjoitti: Consider the following code: a = np.array(zip(np.arange(3)),dtype=[('a',float)]) np.isfinite(a) NotImplemented Seems like a bug. As I understand, NotImplemented is intended to be

[Numpy-discussion] record array question

2009-07-15 Thread Russell E. Owen
Is it straightforward to generate a record array (preferably a standard numpy.ndarray, not the numpy.rec variant) where some named fields contain pairs of numbers, for example: named field pos contains pairs of floats named field rot contains floats Any pointers to relevant documentation would

Re: [Numpy-discussion] record array question

2009-07-15 Thread Russell E. Owen
In article rowen-1ff89a.11051515072...@news.gmane.org, Russell E. Owen ro...@uw.edu wrote: Is it straightforward to generate a record array (preferably a standard numpy.ndarray, not the numpy.rec variant) where some named fields contain pairs of numbers, for example: named field pos

Re: [Numpy-discussion] record array question

2009-07-15 Thread Robert Kern
On Wed, Jul 15, 2009 at 13:05, Russell E. Owenro...@uw.edu wrote: Is it straightforward to generate a record array (preferably a standard numpy.ndarray, not the numpy.rec variant) where some named fields contain pairs of numbers, for example: named field pos contains pairs of floats named

[Numpy-discussion] Record arrays, nesting, and assignment

2009-07-15 Thread Vebjorn Ljosa
Suppose I have a record array where one of the fields is a nested array: from numpy import * desc = dtype([('point', 'i4', 3), ('unimportant', 'S3')]) a = array([((1,2,3), 'foo'), ((7,8,9), 'bar')], dtype=desc) a array([([1, 2, 3], 'foo'), ([7, 8, 9], 'bar')], dtype=[('point', 'i4',

Re: [Numpy-discussion] Record arrays, nesting, and assignment

2009-07-15 Thread Robert Kern
On Wed, Jul 15, 2009 at 14:19, Vebjorn Ljosavebj...@ljosa.com wrote: Suppose I have a record array where one of the fields is a nested array:   from numpy import *   desc = dtype([('point', 'i4', 3), ('unimportant', 'S3')])   a = array([((1,2,3), 'foo'), ((7,8,9), 'bar')], dtype=desc)   a

Re: [Numpy-discussion] Record arrays, nesting, and assignment

2009-07-15 Thread Vebjorn Ljosa
On Jul 15, 2009, at 15:28, Robert Kern wrote: Generally, scalars are never views. a[0] pulls out a record scalar. Thank you, that explains it. I should have noticed that a[0] was just a tuple. Vebjorn ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Record arrays, nesting, and assignment

2009-07-15 Thread Robert Kern
On Wed, Jul 15, 2009 at 14:38, Pauli Virtanenpav...@iki.fi wrote: On 2009-07-15, Robert Kern robert.k...@gmail.com wrote: On Wed, Jul 15, 2009 at 14:19, Vebjorn Ljosavebj...@ljosa.com wrote: Suppose I have a record array where one of the fields is a nested array:   from numpy import *   desc

[Numpy-discussion] Neighbour-frequency matrix

2009-07-15 Thread David Warde-Farley
Here's an interesting problem, and it might've already been solved by some of you folks that do image processing: Suppose I have an 8-bit integer 2-d array, X, and I want a 256x256 matrix that tells me how many times a pixel value v was horizontally (along second dimension) adjacent to a

Re: [Numpy-discussion] Neighbour-frequency matrix

2009-07-15 Thread Vebjorn Ljosa
On Jul 15, 2009, at 17:51, David Warde-Farley wrote: Suppose I have an 8-bit integer 2-d array, X, and I want a 256x256 matrix that tells me how many times a pixel value v was horizontally (along second dimension) adjacent to a pixel value b Is there an efficient way to do such a thing with

[Numpy-discussion] quick C api array creation question

2009-07-15 Thread Charles سمير Doutriaux
Hi, I'm using a C api to create numpy array I create them in my C as follow: np_ow = (PyArrayObject *)PyArray_SimpleNew(4, dims, NPY_DOUBLE); np_osfc = (PyArrayObject *)PyArray_SimpleNew(3, dims, NPY_DOUBLE); np_ospc = (PyArrayObject *)PyArray_SimpleNew(3, dims, NPY_DOUBLE);

Re: [Numpy-discussion] Neighbour-frequency matrix

2009-07-15 Thread David Warde-Farley
On 15-Jul-09, at 6:40 PM, Vebjorn Ljosa wrote: On Jul 15, 2009, at 17:51, David Warde-Farley wrote: Suppose I have an 8-bit integer 2-d array, X, and I want a 256x256 matrix that tells me how many times a pixel value v was horizontally (along second dimension) adjacent to a pixel value b

Re: [Numpy-discussion] quick C api array creation question

2009-07-15 Thread Charles سمير Doutriaux
I think i can answer my own question I need to return Py_BuildValue((NNN)) C. On Jul 15, 2009, at 4:27 PM, Charles سمير Doutriaux wrote: Hi, I'm using a C api to create numpy array I create them in my C as follow: np_ow = (PyArrayObject *)PyArray_SimpleNew(4, dims, NPY_DOUBLE);

Re: [Numpy-discussion] Neighbour-frequency matrix

2009-07-15 Thread Vebjorn Ljosa
On Jul 15, 2009, at 19:37, David Warde-Farley wrote: Just curious - I noticed in the comments that you (or someone) said there's a problem in the original paper's definition. Do you have any idea which feature that concerned? The comments in our previous (Matlab) version of CellProfiler [1]

[Numpy-discussion] [ANN] Announcing the SciPy conference schedule

2009-07-15 Thread Gael Varoquaux
The SciPy conference committee is pleased to announce the schedule of the conference: http://conference.scipy.org/schedule This year’s program is very rich. In order to limit the number of interesting talks that we had to turn down, we decided to reduce the length of talks. Although this results

[Numpy-discussion] Scipy Conference 2009 Lecture Recordings

2009-07-15 Thread Peter Alexander
Hi all, I sure wish I was able to attend this year's event. I'm wondering, and really hoping, if/that the lectures will be recorded and then posted for the whole community's benefit? thanks, ~Peter ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] find_common_type broken?

2009-07-15 Thread Travis Oliphant
On Jul 13, 2009, at 1:54 PM, Ralf Gommers wrote: On Sun, Jul 12, 2009 at 1:24 PM, Citi, Luca lc...@essex.ac.uk wrote: That is what I thought at first, but then what is the difference between array_types and scalar_types? Function signature is: *find_common_type(array_types,