Re: [Numpy-discussion] Default value in documentation

2007-10-04 Thread Alan G Isaac
On Tue, 2 Oct 2007, Charles R Harris apparently wrote: > We're avoiding consolidated fields because they behave > badly. ... The main problem with the consolidated fields > is that they are all put together as item lists in > a definition list and moved to the end of the docstring > when it is

Re: [Numpy-discussion] Best representation for array of points, or, how to distinguish a Nx1 array of points from a Nx3 array of scalars

2007-10-04 Thread Robert Kern
Edson Tadeu wrote: > For now, I solved it using a view with a different type: > > from numpy import * > N = 5 > a=zeros(N,'3f8') > b=a.view() > b.dtype='f8' > b.shape = N,3 Note that this doesn't quite do what you want. I was wrong about the dtype='3f8' syntax: it just gives you a regular float

Re: [Numpy-discussion] Best representation for array of points, or, how to distinguish a Nx1 array of points from a Nx3 array of scalars

2007-10-04 Thread Edson Tadeu
For now, I solved it using a view with a different type: from numpy import * N = 5 a=zeros(N,'3f8') b=a.view() b.dtype='f8' b.shape = N,3 I'll try to put this mechanism in a subclass. Thanks for the answers, Edson On 10/4/07, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > > On Thu, Oct 0

Re: [Numpy-discussion] [SciPy-dev] adopting Python Style Guide for classes

2007-10-04 Thread Pierre GM
On Thursday 04 October 2007 13:08:08 David M. Cooke wrote: > Alan G Isaac <[EMAIL PROTECTED]> writes: > > To help me understand, might someone offer some examples of > > NumPy names that really should be changed? > > Internal classes, like: > - masked_unary_operation, etc. in numpy/core/ma.py FYI,

Re: [Numpy-discussion] Best representation for array of points, or, how to distinguish a Nx1 array of points from a Nx3 array of scalars

2007-10-04 Thread Stefan van der Walt
On Thu, Oct 04, 2007 at 11:47:40AM -0500, Robert Kern wrote: > Edson Tadeu wrote: > > > * Is there any field in the NumPy object where I can keep this > > information (the shape of the "element"), without creeping it with the > > dtype='(M,N)f8' representation I explained above? > > There isn't.

Re: [Numpy-discussion] [SciPy-dev] adopting Python Style Guide for classes

2007-10-04 Thread David M. Cooke
Alan G Isaac <[EMAIL PROTECTED]> writes: > To help me understand, might someone offer some examples of > NumPy names that really should be changed? Internal classes, like: - nd_grid, etc. in numpy/lib/index_tricks.py - masked_unary_operation, etc. in numpy/core/ma.py Things we probably wouldn't

Re: [Numpy-discussion] Best representation for array of points, or, how to distinguish a Nx1 array of points from a Nx3 array of scalars

2007-10-04 Thread Robert Kern
Edson Tadeu wrote: > * Is there any field in the NumPy object where I can keep this > information (the shape of the "element"), without creeping it with the > dtype='(M,N)f8' representation I explained above? There isn't. You could make a subclass that tracks this, but you would have to implement

Re: [Numpy-discussion] Best representation for array of points, or, how to distinguish a Nx1 array of points from a Nx3 array of scalars

2007-10-04 Thread Robert Kern
Alan G Isaac wrote: > On Thu, 4 Oct 2007, Edson Tadeu apparently wrote: >> Is there any field in the NumPy object where I can keep >> this information (the shape of the "element"), without >> creeping it with the dtype='(M,N)f8' >> representation I explained above? > > Perhaps you want a recarr

Re: [Numpy-discussion] Best representation for array of points, or, how to distinguish a Nx1 array of points from a Nx3 array of scalars

2007-10-04 Thread Alan G Isaac
On Thu, 4 Oct 2007, Edson Tadeu apparently wrote: > Is there any field in the NumPy object where I can keep > this information (the shape of the "element"), without > creeping it with the dtype='(M,N)f8' > representation I explained above? Perhaps you want a recarray? Cheers, Alan Isaac ___

[Numpy-discussion] Best representation for array of points, or, how to distinguish a Nx1 array of points from a Nx3 array of scalars

2007-10-04 Thread Edson Tadeu
I've found that there are two ways to represent an array of 3D points: # 01: N = 4 a = numpy.zeros((N, 3), dtype='f8') # 02: N = 4 b = numpy.zeros(N, dtype='3f8') The second representation seems "conceptually" better, it is really an 1D array of N elements ( i.e., b.shape == (4,) ), but, "in

Re: [Numpy-discussion] Possible bug in numpy.trace()

2007-10-04 Thread Stefan van der Walt
Hi Donald On Thu, Oct 04, 2007 at 01:48:18AM +, Donald Fredkin wrote: > It appears that something peculiar is going on with the numpy function > trace(). The docs say that trace(A,...) is identical to A.trace(...). > Here is a test: > > A = arange(8).reshape((2,2,2)) > A.trace(0,1,2) > #[Out]