[AstroPy] Fits table creation: format repeats array: should I expect this?

Jonathan Eisenhamer eisenhamer at stsci.edu
Tue Feb 24 18:06:35 EST 2015


Greetings,

Basic FITS io question. I do the following, which comes basically from the example in the astropy docs:
from astropy.io import fits
import numpy as np
a = np.arange(100.0)
col = fits.Column(name='a100', format='4096E', array=a)
coldefs = fits.ColDefs([col])
hdu = fits.BinTableHDU.from_columns(coldefs)
The array association with the column is "correct", in that the shape of a is (100,).

Except after it has been put into the HDU. Now the array for the column has shape (100, 4096):
hdu.columns[0].array.shape
-> (100, 4096)
Clearly this is because of the format. And at some level this makes sense, but a couple questions:

  *   Why does the format not affect the array until the HDU is created? I.e. The col has just the basic array in it.
  *   Is this expected behavior?

Thank you for your time,

jde
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20150224/c3e35982/attachment.html>


More information about the AstroPy mailing list