Trees | Index | Help |
---|
Package numarray :: Module generic :: Class NDArray |
|
object
--+ |_ndarray
--+ | NDArray
RecArray
Multi-dimensional array abstract base class This class defines the structural operations common to numarray. Subclasses must provide the semantical interpretation of elements, including the __str__, __repr__, _getitem, and _setitem methods. Given an array index of arr[k,j,i] it is always true that the byte offset of the element in the array is computed thusly: with shape[0] --> dimension of current view strides[0] --> bytestride for k index dimension element_byte_offset = byteoffset + ( i*strides[2] + j*strides[1] + k*strides[0]) where 0 <= i < shape[2], 0 <= j < shape[1], 0 <= k < shape[0] For contiguous numarray strides[i] = shape[i+1]*strides[i+1] Summary of attribute meanings: _data buffer with data for the array _shape dimensions of the array _byteoffset The byte offset of the first element from the beginning of the buffer _bytestride The separation between items in bytes. _itemsize The size of items in bytes
Method Summary | |
---|---|
support for copy.copy() | |
support for copy.deepcopy() | |
returns state of NDArray for pickling. | |
__nonzero__(self)
| |
__reduce__ returns the pickling "reduction tuple" for an NDArray. | |
__repr__(self)
| |
restores state of NDArray after unpickling. | |
__str__(self)
| |
astype(self,
type)
| |
Return a new array with the same shape and type, but a copy of the data | |
factory(...) calls the array(...) factory function defined in the source module where the class of 'self' was defined. | |
getflat(self)
| |
getrank(self)
| |
getshape(self)
| |
info() prints out the key attributes of an array. | |
is_c_array() returns 1 iff the array is aligned and contiguous, and returns 0 otherwise. | |
Size (in bytes) of an array element | |
nonzero(self)
| |
put(self,
*indices,
**keywords)
| |
ravel(self) setshapes 'self' into an equivalent 1D array. | |
repeat() returns a new array with each element 'a[i]' repeated 'r[i]' times. | |
resize() shrinks/grows 'self' to new 'shape', possibly replacing the underlying buffer object. | |
setflat(self,
flat)
| |
Change array shape in place. | |
take(self,
*indices,
**keywords)
| |
Write the array as a binary image to a file. | |
Return a string with a binary copy of the array | |
transpose() re-shapes the array by permuting it's dimensions as specified by 'axes'. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value |
Property Summary | |
---|---|
flat : access to array as 1D | |
shape : tuple of array dimensions |
Method Details |
---|
__copy__(self)support for copy.copy() |
__deepcopy__(self, memo)support for copy.deepcopy() |
__getstate__(self)returns state of NDArray for pickling. |
__reduce__(self)__reduce__ returns the pickling "reduction tuple" for an NDArray. Used for NDArray derived from C basetypes, not classic classes.
|
__setstate__(self, state)restores state of NDArray after unpickling. |
copy(self)Return a new array with the same shape and type, but a copy of the data |
factory(self, *args, **keys)factory(...) calls the array(...) factory function defined in the source module where the class of 'self' was defined. |
info(self)info() prints out the key attributes of an array. |
is_c_array(self)is_c_array() returns 1 iff the array is aligned and contiguous, and returns 0 otherwise. |
itemsize(self)Size (in bytes) of an array element |
ravel(self)ravel(self) setshapes 'self' into an equivalent 1D array. |
repeat(self, repeats, axis=0)repeat() returns a new array with each element 'a[i]' repeated 'r[i]' times. |
resize(self, shape, *args)resize() shrinks/grows 'self' to new 'shape', possibly replacing the underlying buffer object. |
setshape(self, shape, *args)Change array shape in place. Call as setshape(i,j,k) or setshape((i,j,k)). |
tofile(self, file)Write the array as a binary image to a file. If file is a string, it attempts to open a file with that name, otherwise it assumes file is a file object. At the moment if special positioning is needed in the file one must do that with the file object beforehand. More options may be added to this method to allow positioning or appends. Note that for numerical data, the system byte order in which the data is represented is *not* recorded in the file. This renders the file non-portable because extra information is required to interpret it on different machines than the one it was created on. |
tostring(self)Return a string with a binary copy of the array Copies are always contiguous, but no conversions are implied |
transpose(self, axes=None)transpose() re-shapes the array by permuting it's dimensions as specified by 'axes'. If 'axes' is none, transpose returns the array with it's dimensions reversed. |
Property Details |
---|
flataccess to array as 1D |
shapetuple of array dimensions |
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Thu Apr 21 13:11:50 2005 | http://epydoc.sf.net |