[AstroPy] issue with initialisation of a fits binary table

Paul Kuin npkuin at gmail.com
Thu Sep 4 21:24:45 EDT 2014


Hi,

I have a question about io.fits

I wonder if I just miss something obvious, or it can only be done as a
later fix. Let me explain my problem.

When adding a card to the header, I can do that as

header["NEW_KEY"]=("SOME_VALUE","this is an example")
and in the header I get
NEW_KEY = "SOME_VALUE"   \ this is an example

So with a keyword.

Now, when I define a new column like

col = [fits.Column(name="Vmag",format="E",unit="mag",ascii=False)]
I can create a binary table
tab = fits.BinTableHDU.from_columns(columns=col)

The header then is created with a TTYPE keyword with a value, but without a
comment.
Comments are sometimes very useful, and so I checked.

I can define
col = [fits.Column(name=("Vmag","some
comment"),format="E",unit="mag",ascii=False)]
which goes some way to being able to have a TTYPE keyword with value and
comment,
but then trying to create the binary table HDU as before, it fails.

Am I missing something?

I can probably go back in and modify the header to add comments once I have
the bintable HDU defined, but it seems so inelegant I did not even try.


    Paul

-- 

* * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * *
Dr. N.P.M. Kuin      (n.kuin at ucl.ac.uk)
phone +44-(0)1483 (prefix) -204927 (work)
mobile +44(0)7806985366  skype ID: npkuin
Mullard Space Science Laboratory  – University College London  –
Holmbury St Mary – Dorking – Surrey RH5 6NT–  U.K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20140905/55c2a231/attachment.html>


More information about the AstroPy mailing list