[AstroPy] support for multi-dimensional table columns in pyfits

Jonathan Slavin jslavin@cfa.harvard....
Wed Mar 30 08:18:05 CDT 2011

To any pyfits developers out there:

I'd like to request that support for multidimensional columns in binary
tables be added to pyfits.  It doesn't seem that it should be too hard,
though  in going through the code it's not clear to me the best way to
proceed -- the Delayed type of data complicates things.  The dimensions
that the array should have are contained in the dims attribute of the
Column object (as a string), but  multidimensional arrays are returned
as 1-D arrays.  Once reshaped, the data is correct (though the order of
the dimensions has to be reversed).

The IDL routine mrdfits handles this very easily.  Ideally one could do
something like:
data = pyfits.getdata(file,exten)
and data.varname would contain an ndarray of the proper shape.  As it
is, the returned variables have shape (1,N) where N is the total number
of elements.

Jonathan D. Slavin              Harvard-Smithsonian CfA
jslavin@cfa.harvard.edu         60 Garden Street, MS 83
phone: (617) 496-7981           Cambridge, MA 02138-1516
 cell: (781) 363-0035           USA

More information about the AstroPy mailing list