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

Edson Tadeu e.tadeu@gmail....
Thu Oct 4 14:14:00 CDT 2007


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 <stefan@sun.ac.za> wrote:
>
> 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. You could make a subclass that tracks this, but you would
> have to
> > implement it carefully to maintain the information.
>
> There is an example of how to do that here:
>
> http://www.scipy.org/Subclasses
>
> Regards
> Stéfan
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071004/b1f5884b/attachment.html 


More information about the Numpy-discussion mailing list