Re: [Numpy-discussion] Bug or feature?

2011-08-23 Thread Stéfan van der Walt
On Tue, Aug 23, 2011 at 1:13 PM, Fernando Perez wrote: > Off the top of my head, here are a few ideas for enterprising souls to make a > very useful contribution with a howto on each of these topics: > > - dtype/structured arrays and record arrays > - fancy indexing, broadcasting, lib.index_trick

Re: [Numpy-discussion] Bug or feature?

2011-08-23 Thread Fernando Perez
On Mon, Aug 22, 2011 at 11:28 PM, Konrad Hinsen wrote: > Thanks, that sounds reasonable. But is this role of tuples in the > creation of structured arrays documented anywhere? The documentation > on structured arrays concentrates on specifying the dtype. All I could > find about array constructio

Re: [Numpy-discussion] Efficient way to load a 1Gb file?

2011-08-23 Thread Derek Homeier
On 11.08.2011, at 8:50PM, Russell E. Owen wrote: > It seems a shame that loadtxt has no argument for predicted length, > which would allow preallocation and less appending/copying data. > > And yes...reading the whole file first to figure out how many elements > it has seems sensible to me -- a

[Numpy-discussion] Wrong treatment of byte order?

2011-08-23 Thread Nadav Horesh
My system is a 64 bit gentoo linux on core i7 machine. Numpy version 1.6.1 and pyton(s) 2.7.2 and 3.2.1 Problem summary: I tried t invert a matrix of explicit little endian byte-order and got an error. The inversion run properly with a native byte order, and I get a wrong answer with not error

Re: [Numpy-discussion] memoryview shape/strides representation for ndim = 0

2011-08-23 Thread Stefan Krah
Mark Dickinson wrote: > On Mon, Aug 22, 2011 at 1:30 PM, Stefan Krah > wrote: > > Numpy arrays and memoryview currently have different representations > > for shape and strides if ndim = 0: [...] > > I think the Numpy representation is nicer. Also, I think that memoryviews > > should attempt to

[Numpy-discussion] PyBUF_SIMPLE/PyBUF_FORMAT: casts to unsigned bytes

2011-08-23 Thread Stefan Krah
Hello, PEP-3118 presumably intended that a PyBUF_SIMPLE request should cast the original buffer's data type to 'B' (unsigned bytes). Here is a one-dimensional example that currently occurs in Lib/test/test_multiprocessing: >>> import array, io >>> a = array.array('i', [1,2,3,4,5]) >>> m = memoryv