[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] subclassing ndarray and recarray

2007-05-11 Thread Bernhard Voigt
return obj def __getslice__(self,i,j): obj = numpy.array(numpy.ndarray.__getslice__(self, i,j)).view(type(self)) obj.__make_mapping(range(i,j+1)) return obj -- Bernhard Voigt Phone: ++49 33762 - 7 - 7291 DESY, Zeuthen Mail: [EMAIL PROTECTED] Pl

Re: [Numpy-discussion] subclassing ndarray and recarray

2007-05-10 Thread Bernhard Voigt
is correct, because it's passed to ndarray.__getitem__ In [32]: bar Out[32]: arraydict([(-1.4037792804089142, 0.37263515556827359), (0.077070370958404841, -1.4284963747790793), (0.88821059412119174, 0.29415143595187959)], dtype=[('x', ' wrote: On Wednesday 09 M

Re: [Numpy-discussion] 6 new messages in 4 topics - abridged

2007-05-10 Thread Bernhard Voigt
, (0.077070370958404841, -1.4284963747790793), (0.88821059412119174, 0.29415143595187959)], dtype=[('x', ' wrote: On Wednesday 09 May 2007 08:54:37 Bernhard Voigt wrote: > I'm trying to subclass ndarray or recarray to build a record array that has > a dictionary

[Numpy-discussion] subclassing ndarray and recarray

2007-05-09 Thread Bernhard Voigt
I'm trying to subclass ndarray or recarray to build a record array that has a dictionary with a mapping of keys to array indexes and vice versa. I come across the problem, that depending on the field access method I get different types back: # a is a sublcass of record array print type(a) pr

[Numpy-discussion] Slicing with index lists

2007-04-12 Thread Bernhard Voigt
Dear all! in a 2-dim array I would like to select rows specified by a list of indexes and from these rows I'd like to select columns specified by another list of indexes. That's what I found as a solution: In [90]: a = arange(15).reshape(5,3) In [91]: a Out[91]: array([[ 0, 1, 2], [ 3,

[Numpy-discussion] Installation

2007-01-12 Thread Bernhard Voigt
Dear all, I've recently installed the last releases of numpy and scipy (tar archives from scipy.org). I encountered two problems: 1) During the configuration it seems the information from my site.cfg is not read. 2) Installation using atlas optimized lapack/blas libraries didn't work 1) My site