From: Francesc A. <fa...@op...> - 2003-01-18 18:17:41
|
A Dissabte 18 Gener 2003 17:41, Todd Miller va escriure: > >I just want to access the buffer data, and the shape of this object fr= om C > >(well, I'm actually using Pyrex, but I think this is not important). I= s > > that possible by only using numarray C calls? > > Look at Lib/chararray.py and Src/_chararraymodule.c. > > If you can handle using a CharArray or RawCharArray, try: > > 1. call NA_updateDataPtr( array ) to refresh the data buffer pointer in > the PyArrayObject. Even _chararraymodule.c doesn't do this right yet. > > 2. call NA_OFFSETDATA(array) to add the byteoffset to the pointer. > > 3. shape, strides, and itemsize should be directly accessible from the > PyArrayObject. Ok. I'll try to do that. > > CharArray has some extra stripping and padding semantics; these are laz= y > and hence absent without extra care in C. RawCharArray has none. > By the way, is it safe to assume that CharArray objects are contiguous? o= r RawCharArray?. The same question goes for RecArray objects. Or it is alwa= ys convenient to check with iscontiguous() method if they are or not?. In ca= se these objects can be non-contiguous, I guess there's still not a function like NA_InputArray that works with CharArray or RecArray objects in order= to obtain well-behaved objects. Is that true? I think it would be possible to me to include support for numarray object= s in next release of PyTables. Thanks!, --=20 Francesc Alted |