[Matrix-SIG] NumPy arrays with object typecode

Paul Barrett barrett@compass.gsfc.nasa.gov
Tue, 2 Feb 1999 14:29:36 -0500 (EST)


Oliver Gathmann writes:
 > Hello,
 > 
 > I am working on something like an S-Plus frame that would allow efficient
 > access to data of different types (integers, floats, and strings)
 > organized in colums of an ordinary 2d-array. My idea is to use NumPy
 > arrays of typecode 'O'; I know this sacrifices a lot of the performance of
 > genuine numerical arrays, but they still offer their nifty indexing and
 > slicing capabilities.
 > 

I'm currently working on a C extension class to do just this.  I hope
to have a useable, though by no means complete, version by the end of
the week.  Given an array shape and format string (similar to that
used by pack and unpack), a recarray object is created which allows
access to the data by array syntax.  This module is really just a
generalization of the struct module, but allows much more efficient
access to large arrays of binary data.

A paper by Barrett and Bridgman (see
http://www.dpt.stsci.edu/dpt_papers/opus_bib.html) presented last
November at the Astronomical Data Analysis Software and Systems
Conference gives a synopsis of this extension module as it relates to
PyFITS, a Python module for reading and writing FITS format files.

 -- Paul